Skip to main content

Posts

Showing posts from April, 2014

C# allow nullable value get from EF

You can get value from Entity framework which can allow null able and you can also perform filtering in your query. private static IQueryable<EmployeeInformation> ReportFilteringEmployeeInformations(Guid factoryId, Guid departmentId, Guid designationId, string empId, string empName, Guid sectionId, Guid categoryEmpId, int? CategoryTypeID, Guid categorySalaryID, Guid blockID,string cardNo, PayrollEntities context) { var query = from emp in context.vw_PIS_TblEmployeeGenInfo join des in context.vw_PIS_TblEmployeeDesignation on emp.GDesignationInfoID equals des.GDesignationInfoID into des_J join dept in context.vw_PIS_tblDepartment on emp.GDepartmentID equals dept.GDepartmentID into dept_J join sec in context.vw_PIS_TblSection on emp.SectionID equals sec.SectionID into sec_J from des1 in des_J.DefaultIfEmpty() from dept1 in dept_J.DefaultIfEmpty() from sec1 in sec_J.D

Schedule Mail Sending with attachment file ASP.NET MVC

For scheduling mail i am using JobcashAction. It's simple Open your Global.asax.cs file just use the following code. public class MvcApplication : System.Web.HttpApplication { // Define Path Of the Job private const string JobCashAction = "http://localhost:38416/Home/AddJobCache"; protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); } protected void Application_BeginRequest(object sender, EventArgs e) { if (HttpContext.Current.Cache["jobkey"] == null) { HttpContext.Current.Cache.Add("jobkey", "jobvalue", null,

ASP.NET MVC Mail Sending with attachment file

You can send mail with attach file using the code MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("atiour.islam@gmail.com"); mail.To.Add("atik.kotha@gmail.com"); mail.Subject = "Test"; mail.Body = "Hi"; System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment("D:\\ff.pdf"); mail.Attachments.Add(attachment); SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("atiour.islam@gmail.com", "password"); SmtpServer.EnableSsl = true; SmtpServer.Timeout = 60000; SmtpServer.Send(mail);

Crystal report Save as Pdf in defined path

Spending a lot's of time i figure out that you can save a crystal report as pdf in your defined path, It can be your local drive or server path. List<Student> studentList = new List<Student>(); studentList = GetStudentInfo(); ReportDocument details = new ReportDocument(); details.Load(Server.MapPath("../Report/rptStudent.rpt")); details.SetDataSource(studentList); details.ExportToDisk(ExportFormatType.PortableDocFormat, "D:\\ff.pdf"); Hope it will help you.

Sap crystal report front size problem after export in pdf

1. open Command Window 2. enter 'regedit' and enter 3. Navigate to HKEY_CURRENT_USER -> Software -> Business Objects-> Suite 12-> Crystal Reports-> Export 4. Rightclick 'Export' -> New -> Key 5. Enter 'PDF' 6. In the newly created Key add 3 new DWORD a. 'ForceLargerFonts' with value 1 b. 'TruncationAdjustment' with value 2 c. 'UsePrecisePositioningForText' with value 1 6.Navigate to HKEY_LOCAL_MACHINE -> Software->Wow6432Node->Business Objects->Suite 12-> Crystal Reports-> Export 7.Repeat steps 4,5 and 6 Or Follow the Link http://www.linkedin.com/groups/Fonts-margin-shrinking-when-exporting-123302.S.138244632

ASP.NET MVC Cashcading dropdown

View Page @model FactoryProduct.Web.Areas.Payroll.Models.EmployeeLeaveCalendarModels <script> function getDepartmentReleatedData(ctrl) { var DepartmentId = $('#EmployeeLeaveCalendar_GDepartmentID').val(); var FactoryId = $('#EmployeeLeaveCalendar_GFactoryID').val(); var s = ','; if (DepartmentId != "00000000-0000-0000-0000-000000000000" && DepartmentId != "" && FactoryId != "00000000-0000-0000-0000-000000000000" && FactoryId != "") { var p = (FactoryId + s + DepartmentId) GetDesignationByDepartment(p); //GetCategogyByDepartmentId(p); //GetSectionByDepartmentId(p); //GetEmpCategogyByDepartmentId(p); } return false; } function GetDesignationByDepartment(Id) { $('#EmployeeLeaveCalendar_GDesignationInfoID> option:not(:first)').remove(); var form = $("#frmLe