// POST api/basicinformation public int Post([FromBody] BasicInformaionEntities item) { var root = System.Web.Hosting.HostingEnvironment.MapPath("~/images/"); DirectoryInfo di = new DirectoryInfo(root); FileInfo[] images = di.GetFiles(); foreach (FileInfo image in images) { var name = image.Name; if (name.Contains("user.png")) { long imageFileLength = image.Length; FileStream fs = new FileStream(root + name, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); var imageData = br.ReadBytes((int)imageFileLength); item.EMPIMG = imageData; } } //string[] files = Directory.GetFiles(root, "*.png"); //foreach (string file in Directory.GetFiles(root)) //{ // var name = file.fo; // if (name.Contains(keyword)) // { // imgname = name; // } //} return(_Basicinfo.CreateEmployeebasicinfo(item)); }
// PUT api/basicinformation/5 public bool Put(int id, [FromBody] BasicInformaionEntities item) { if (id > 0) { return(_Basicinfo.UpdateEmployeebasicinfo(id, item)); } return(false); }
public async Task <ActionResult> EmployeeCreate(BasicInformaionEntities bie) { //if (ModelState.IsValid) //{ HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "basicinformation", bie); if (responseMessage.IsSuccessStatusCode) { TempData["sucsmsg"] = "saved"; return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public int Post([FromBody] BasicInformaionEntities item) { return(_Basicinfo.CreateEmployeebasicinfo(item)); }
public bool UpdateEmployeebasicinfo(int BasicinfoId, BasicInformaionEntities BasicinfoEntities) { throw new NotImplementedException(); }
public int CreateEmployeebasicinfo(BasicInformaionEntities BasicinfoEntities) { throw new NotImplementedException(); }
private async Task <HttpResponseMessage> UseMultipartFormDataStream() { string root = HttpContext.Current.Server.MapPath("~/images"); var provider = new MultipartFormDataStreamProvider(root); MultipartFormDataContent mpfdc = new MultipartFormDataContent(); // DEFINE THE PATH WHERE WE WANT TO SAVE THE FILES. string sPath = ""; sPath = System.Web.Hosting.HostingEnvironment.MapPath("~/images/"); System.Web.HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files; // CHECK THE FILE COUNT. for (int iCnt = 0; iCnt <= hfc.Count - 1; iCnt++) { System.Web.HttpPostedFile hpf = hfc[iCnt]; var filepath = string.Empty; var fileNamefuStamp = string.Empty; var physicalPathfuStamp = string.Empty; if (hpf.ContentLength > 0) { // CHECK IF THE SELECTED FILE(S) ALREADY EXISTS IN FOLDER. (AVOID DUPLICATE) if (!File.Exists(sPath + Path.GetFileName(hpf.FileName))) { // SAVE THE FILES IN THE FOLDER. Bitmap bitmapImage = ResizeImage(hpf.InputStream, 200, 200); System.IO.MemoryStream stream = new System.IO.MemoryStream(); bitmapImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); var data = stream.ToArray(); // Random r = new Random(); // string code = r.Next().ToString(); // fileNamefuStamp = Path.GetFileName(code + hpf.FileName); // physicalPathfuStamp = Path.Combine(Server.MapPath("~/Models/"), fileNamefuStamp); //filepath = "\\images\\Partners\\" + code + x.FileName; //filepath = code + file.FileName; //File.WriteAllBytes(sPath + Path.GetFileName(hpf.FileName), (data as byte[])); //file.SaveAs(Server.MapPath("~/images/Partners/" + fileNamefuStamp)); //hpf.SaveAs(sPath + Path.GetFileName(hpf.FileName)); // iUploadedCnt = iUploadedCnt + 1; BasicInformaionEntities item = new BasicInformaionEntities(); item.EMPLOYEE_IMAGE = Path.GetFileName(hpf.FileName); item.EMPIMG = data; string s = hpf.FileName; int ix = s.IndexOf('_'); //s = ix != -1 ? s.Substring(ix + 1) : s; //using the ternary operator here is quite useless, better to write: //yourStringVariable.Substring(0, ix); s = s.Substring(0, ix); int id = Convert.ToInt32(new String(s.ToCharArray().Where(c => Char.IsDigit(c)).ToArray())); bool b = _Basicinfo.UpdateEmployeebasicinfo(id, item); } } //else //{ // return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ""); //} } var response = Request.CreateResponse(); response.StatusCode = HttpStatusCode.OK; return(response); //var file = provider.FileData; //if (file != null && file. > 0) //{ // var filename = file.Headers.ContentDisposition.FileName; // var path = Path.Combine(Server.MapPath("~/App_Data/"), fileName); // file.SaveAs(path); //} //try //{ // await Request.Content.ReadAsMultipartAsync(provider); // foreach (MultipartFileData file in provider.FileData) // { // var filename = file.Headers.ContentDisposition.FileName; // Trace.WriteLine(filename); // Trace.WriteLine("Server file path: " + file.LocalFileName); // mpfdc.Add(new ByteArrayContent(File.ReadAllBytes(file.LocalFileName)), "File", filename); // var path = Path.Combine(root, filename); // } // var response = Request.CreateResponse(); // response.Content = mpfdc; // response.StatusCode = HttpStatusCode.OK; // return response; //} //catch (System.Exception e) //{ // return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e); //} }
public bool UpdateEmployeebasicinfo(int BasicinfoId, BasicInformaionEntities BasicinfoEntities) { var success = false; if (BasicinfoEntities != null) { //using (var scope = new TransactionScope()) // { try { var project = _UOW.EMP_BASICINFORepository.GetByID(BasicinfoId); if (project != null) { if (BasicinfoEntities.EMPLOYEE_CODE != "" && BasicinfoEntities.EMPLOYEE_CODE != null) { project.EMPLOYEE_CODE = BasicinfoEntities.EMPLOYEE_CODE; } if (BasicinfoEntities.EMPLOYEE_FIRSTNAME != "" && BasicinfoEntities.EMPLOYEE_FIRSTNAME != null) { project.EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME; } if (BasicinfoEntities.EMPLOYEE_MIDDLENAME != "" && BasicinfoEntities.EMPLOYEE_MIDDLENAME != null) { project.EMPLOYEE_MIDDLENAME = BasicinfoEntities.EMPLOYEE_MIDDLENAME; } if (BasicinfoEntities.EMPLOYEE_FIRSTNAME != "" && BasicinfoEntities.EMPLOYEE_FIRSTNAME != null) { project.EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME; } if (BasicinfoEntities.DATE_OF_BIRTH != null) { project.DATE_OF_BIRTH = BasicinfoEntities.DATE_OF_BIRTH; } if (BasicinfoEntities.AGE != null) { project.AGE = BasicinfoEntities.AGE; } if (BasicinfoEntities.SEX != "" && BasicinfoEntities.SEX != null) { project.SEX = BasicinfoEntities.SEX; } if (BasicinfoEntities.MATERIAL_STATUS != "" && BasicinfoEntities.MATERIAL_STATUS != null) { project.MATERIAL_STATUS = BasicinfoEntities.MATERIAL_STATUS; } if (BasicinfoEntities.WEDDING_ANNIVERSARY != null) { project.WEDDING_ANNIVERSARY = BasicinfoEntities.WEDDING_ANNIVERSARY; } if (BasicinfoEntities.REPORTING_TO != "" && BasicinfoEntities.REPORTING_TO != null) { project.REPORTING_TO = BasicinfoEntities.REPORTING_TO; } if (BasicinfoEntities.GRADE != null) { project.GRADE = BasicinfoEntities.GRADE; } if (BasicinfoEntities.DIVISION != "" && BasicinfoEntities.DIVISION != null) { project.DIVISION = BasicinfoEntities.DIVISION; } if (BasicinfoEntities.SUBDIVISION != "" && BasicinfoEntities.SUBDIVISION != null) { project.SUBDIVISION = BasicinfoEntities.SUBDIVISION; } if (BasicinfoEntities.SECTION != "" && BasicinfoEntities.SECTION != null) { project.SECTION = BasicinfoEntities.SECTION; } if (BasicinfoEntities.BLOOD_GROUP != null) { project.BLOOD_GROUP = BasicinfoEntities.BLOOD_GROUP; } if (BasicinfoEntities.HEIGHT != null) { project.HEIGHT = BasicinfoEntities.HEIGHT; } if (BasicinfoEntities.WEIGHT != null) { project.WEIGHT = BasicinfoEntities.WEIGHT; } if (BasicinfoEntities.MEDICLAIM_NUMBER != "" && BasicinfoEntities.MEDICLAIM_NUMBER != null) { project.MEDICLAIM_NUMBER = BasicinfoEntities.MEDICLAIM_NUMBER; } if (BasicinfoEntities.ESIC_NO != "" && BasicinfoEntities.ESIC_NO != null) { project.ESIC_NO = BasicinfoEntities.ESIC_NO; } if (BasicinfoEntities.PF_UNID_NUMBER != "" && BasicinfoEntities.PF_UNID_NUMBER != null) { project.PF_UNID_NUMBER = BasicinfoEntities.PF_UNID_NUMBER; } if (BasicinfoEntities.INDUCTION != "" && BasicinfoEntities.INDUCTION != null) { project.INDUCTION = BasicinfoEntities.INDUCTION; } if (BasicinfoEntities.IDENTIFICATION_MARK != "" && BasicinfoEntities.IDENTIFICATION_MARK != null) { project.IDENTIFICATION_MARK = BasicinfoEntities.IDENTIFICATION_MARK; } if (BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != "" && BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != null) { project.LAST_MAJOR_ILLNESS_SURGERY = BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY; } if (BasicinfoEntities.ALLERGY_HISTORY != "" && BasicinfoEntities.ALLERGY_HISTORY != null) { project.ALLERGY_HISTORY = BasicinfoEntities.ALLERGY_HISTORY; } if (BasicinfoEntities.PHYSICAL_DISABILITY != "" && BasicinfoEntities.PHYSICAL_DISABILITY != null) { project.PHYSICAL_DISABILITY = BasicinfoEntities.PHYSICAL_DISABILITY; } if (BasicinfoEntities.HIRING_TYPE != "" && BasicinfoEntities.HIRING_TYPE != null) { project.HIRING_TYPE = BasicinfoEntities.HIRING_TYPE; } if (BasicinfoEntities.CV_TYPE != "" && BasicinfoEntities.CV_TYPE != null) { project.CV_TYPE = BasicinfoEntities.CV_TYPE; } if (BasicinfoEntities.YEAR_OF_EXPERIENCE != null) { project.YEAR_OF_EXPERIENCE = BasicinfoEntities.YEAR_OF_EXPERIENCE; } if (BasicinfoEntities.EXIT_DATE != null) { project.EXIT_DATE = BasicinfoEntities.EXIT_DATE; } if (BasicinfoEntities.EXIT_TYPE != null) { project.EXIT_TYPE = BasicinfoEntities.EXIT_TYPE; } if (BasicinfoEntities.REFERENCE != "" && BasicinfoEntities.REFERENCE != null) { project.REFERENCE = BasicinfoEntities.REFERENCE; } if (BasicinfoEntities.EMPLOYEE_IMAGE != "" && BasicinfoEntities.EMPLOYEE_IMAGE != null) { project.EMPLOYEE_IMAGE = BasicinfoEntities.EMPLOYEE_IMAGE; } if (BasicinfoEntities.EMPIMG != null) { project.EMPIMG = BasicinfoEntities.EMPIMG; } //cache.Remove(CacheKey); _UOW.EMP_BASICINFORepository.Update(project); _UOW.Save(); //scope.Complete(); success = true; } } catch (Exception ex) { log.Debug("Debug error logging", ex); log.Info("Info error logging", ex); log.Warn("Warn error logging", ex); log.Error("Error error logging", ex); log.Fatal("Fatal error logging", ex); } //} } return(success); }
public int CreateEmployeebasicinfo(BasicInformaionEntities BasicinfoEntities) { int status = 0; if (BasicinfoEntities != null) { try { var project = _UOW.EMP_BASICINFORepository.GetByID(Convert.ToInt32(BasicinfoEntities.ID)); if (project != null) { if (BasicinfoEntities.JOININGDATE != null) { var joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.JOINING_DATE = joiningdate; } if (BasicinfoEntities.EMPLOYEE_CODE != "" && BasicinfoEntities.EMPLOYEE_CODE != null) { project.EMPLOYEE_CODE = BasicinfoEntities.EMPLOYEE_CODE; } if (BasicinfoEntities.EMPLOYEE_FIRSTNAME != "" && BasicinfoEntities.EMPLOYEE_FIRSTNAME != null) { project.EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME; } if (BasicinfoEntities.EMPLOYEE_MIDDLENAME != "" && BasicinfoEntities.EMPLOYEE_MIDDLENAME != null) { project.EMPLOYEE_MIDDLENAME = BasicinfoEntities.EMPLOYEE_MIDDLENAME; } if (BasicinfoEntities.EMPLOYEE_LASTNAME != "" && BasicinfoEntities.EMPLOYEE_LASTNAME != null) { project.EMPLOYEE_LASTNAME = BasicinfoEntities.EMPLOYEE_LASTNAME; } if (BasicinfoEntities.DOB != null && BasicinfoEntities.DOB != "") { var DOB = DateTime.ParseExact(BasicinfoEntities.DOB, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.DATE_OF_BIRTH = DOB; } if (BasicinfoEntities.AGE != null) { project.AGE = BasicinfoEntities.AGE; } if (BasicinfoEntities.SEX != "" && BasicinfoEntities.SEX != null) { project.SEX = BasicinfoEntities.SEX; } if (BasicinfoEntities.MATERIAL_STATUS != "" && BasicinfoEntities.MATERIAL_STATUS != null) { project.MATERIAL_STATUS = BasicinfoEntities.MATERIAL_STATUS; } if (BasicinfoEntities.WEDDING != null && BasicinfoEntities.WEDDING != "") { var WEDDING = DateTime.ParseExact(BasicinfoEntities.WEDDING, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.WEDDING_ANNIVERSARY = WEDDING; } if (BasicinfoEntities.REPORTING_TO != "" && BasicinfoEntities.REPORTING_TO != "0") { project.REPORTING_TO = BasicinfoEntities.REPORTING_TO; } if (BasicinfoEntities.DEPARTMENT != null && BasicinfoEntities.DEPARTMENT != 0) { project.DEPARTMENT = BasicinfoEntities.DEPARTMENT; } if (BasicinfoEntities.DESIGNATION != null && BasicinfoEntities.DESIGNATION != 0) { project.DESIGNATION = BasicinfoEntities.DESIGNATION; } if (BasicinfoEntities.GRADE != null && BasicinfoEntities.GRADE != 0) { project.GRADE = BasicinfoEntities.GRADE; } if (BasicinfoEntities.DIVISION != "" && BasicinfoEntities.DIVISION != "0") { project.DIVISION = BasicinfoEntities.DIVISION; } if (BasicinfoEntities.SUBDIVISION != "" && BasicinfoEntities.SUBDIVISION != "0") { project.SUBDIVISION = BasicinfoEntities.SUBDIVISION; } if (BasicinfoEntities.SECTION != "" && BasicinfoEntities.SECTION != "0") { project.SECTION = BasicinfoEntities.SECTION; } if (BasicinfoEntities.BLOOD_GROUP != null && BasicinfoEntities.BLOOD_GROUP != 0) { project.BLOOD_GROUP = BasicinfoEntities.BLOOD_GROUP; } if (BasicinfoEntities.HEIGHT != null) { project.HEIGHT = BasicinfoEntities.HEIGHT; } if (BasicinfoEntities.WEIGHT != null) { project.WEIGHT = BasicinfoEntities.WEIGHT; } if (BasicinfoEntities.MEDICLAIM_NUMBER != "" && BasicinfoEntities.MEDICLAIM_NUMBER != null) { project.MEDICLAIM_NUMBER = BasicinfoEntities.MEDICLAIM_NUMBER; } if (BasicinfoEntities.ESIC_NO != "" && BasicinfoEntities.ESIC_NO != null) { project.ESIC_NO = BasicinfoEntities.ESIC_NO; } if (BasicinfoEntities.PF_UNID_NUMBER != "" && BasicinfoEntities.PF_UNID_NUMBER != null) { project.PF_UNID_NUMBER = BasicinfoEntities.PF_UNID_NUMBER; } if (BasicinfoEntities.INDUCTION != "" && BasicinfoEntities.INDUCTION != null) { project.INDUCTION = BasicinfoEntities.INDUCTION; } if (BasicinfoEntities.IDENTIFICATION_MARK != "" && BasicinfoEntities.IDENTIFICATION_MARK != null) { project.IDENTIFICATION_MARK = BasicinfoEntities.IDENTIFICATION_MARK; } if (BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != "" && BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != null) { project.LAST_MAJOR_ILLNESS_SURGERY = BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY; } if (BasicinfoEntities.ALLERGY_HISTORY != "" && BasicinfoEntities.ALLERGY_HISTORY != null) { project.ALLERGY_HISTORY = BasicinfoEntities.ALLERGY_HISTORY; } if (BasicinfoEntities.PHYSICAL_DISABILITY != "" && BasicinfoEntities.PHYSICAL_DISABILITY != null) { project.PHYSICAL_DISABILITY = BasicinfoEntities.PHYSICAL_DISABILITY; } if (BasicinfoEntities.HIRING_TYPE != "" && BasicinfoEntities.HIRING_TYPE != "0") { project.HIRING_TYPE = BasicinfoEntities.HIRING_TYPE; } if (BasicinfoEntities.CV_TYPE != "" && BasicinfoEntities.CV_TYPE != "0") { project.CV_TYPE = BasicinfoEntities.CV_TYPE; } if (BasicinfoEntities.YEAR_OF_EXPERIENCE != null) { project.YEAR_OF_EXPERIENCE = BasicinfoEntities.YEAR_OF_EXPERIENCE; } if (BasicinfoEntities.EXITDATE != null && BasicinfoEntities.EXITDATE != null) { var EXITDATE = DateTime.ParseExact(BasicinfoEntities.EXITDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.EXIT_DATE = EXITDATE; var trdtls = _UOW.TRANSFER_DETAILSMASTERRepository.GetManyQueryable(x => x.EMPLOYEE_ID == BasicinfoEntities.ID).OrderBy(y => y.ID).LastOrDefault(); if (trdtls != null) { trdtls.TO_DATE = EXITDATE; trdtls.STATUS = "Inactive"; } _UOW.TRANSFER_DETAILSMASTERRepository.Update(trdtls); _UOW.Save(); project.STATUS = "Inactive"; } if (BasicinfoEntities.RESIGNATIONDATE != "" && BasicinfoEntities.RESIGNATIONDATE != null) { var resigndate = DateTime.ParseExact(BasicinfoEntities.RESIGNATIONDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.RESIGNATIONDATE = resigndate; } if (BasicinfoEntities.LEAVEENCASHMENT != "" && BasicinfoEntities.LEAVEENCASHMENT != null) { project.LEAVEENCASHMENT = BasicinfoEntities.LEAVEENCASHMENT; } if (BasicinfoEntities.EXIT_TYPE != null && BasicinfoEntities.EXIT_TYPE != 0) { project.EXIT_TYPE = BasicinfoEntities.EXIT_TYPE; } if (BasicinfoEntities.REFERENCE != "" && BasicinfoEntities.REFERENCE != null) { project.REFERENCE = BasicinfoEntities.REFERENCE; } if (BasicinfoEntities.FULL_N_FINAL_STATUS != "0" && BasicinfoEntities.FULL_N_FINAL_STATUS != null) { project.FULL_N_FINAL_STATUS = BasicinfoEntities.FULL_N_FINAL_STATUS; } if (BasicinfoEntities.WORKLOCATION != null && BasicinfoEntities.WORKLOCATION != 0) { project.WORKLOCATION = BasicinfoEntities.WORKLOCATION; } if (BasicinfoEntities.RELIGION != "" && BasicinfoEntities.RELIGION != null) { project.RELIGION = BasicinfoEntities.RELIGION; } if (BasicinfoEntities.MOTHERTOUNGE != "" && BasicinfoEntities.MOTHERTOUNGE != null) { project.MOTHERTOUNGE = BasicinfoEntities.MOTHERTOUNGE; } if (BasicinfoEntities.DOMICILE_STATUS != "" && BasicinfoEntities.DOMICILE_STATUS != null) { project.DOMICILE_STATUS = BasicinfoEntities.DOMICILE_STATUS; } if (BasicinfoEntities.EXITCATAGORY != null) { project.EXITCATAGORY = BasicinfoEntities.EXITCATAGORY; } //cache.Remove(CacheKey); _UOW.EMP_BASICINFORepository.Update(project); _UOW.Save(); status = Convert.ToInt32(BasicinfoEntities.ID); } else { var joiningdate = (DateTime?)null; //DateTime joiningdate = Convert.ToDateTime(BasicinfoEntities.JOININGDATE); if (BasicinfoEntities.JOININGDATE != null) { joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); } //var joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); var bsicinfo = new TBL_EMP_BASICINFO { DESIGNATION = BasicinfoEntities.DESIGNATION, JOINING_DATE = joiningdate, EMPLOYEE_CODE = BasicinfoEntities.EMPLOYEE_CODE, EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME, EMPLOYEE_MIDDLENAME = BasicinfoEntities.EMPLOYEE_MIDDLENAME, EMPLOYEE_LASTNAME = BasicinfoEntities.EMPLOYEE_LASTNAME, DATE_OF_BIRTH = BasicinfoEntities.DATE_OF_BIRTH, AGE = BasicinfoEntities.AGE, SEX = BasicinfoEntities.SEX, MATERIAL_STATUS = BasicinfoEntities.MATERIAL_STATUS, WEDDING_ANNIVERSARY = BasicinfoEntities.WEDDING_ANNIVERSARY, REPORTING_TO = BasicinfoEntities.REPORTING_TO, GRADE = BasicinfoEntities.GRADE, DIVISION = BasicinfoEntities.DIVISION, SUBDIVISION = BasicinfoEntities.SUBDIVISION, SECTION = BasicinfoEntities.SECTION, BLOOD_GROUP = BasicinfoEntities.BLOOD_GROUP, HEIGHT = BasicinfoEntities.HEIGHT, WEIGHT = BasicinfoEntities.WEIGHT, MEDICLAIM_NUMBER = BasicinfoEntities.MEDICLAIM_NUMBER, ESIC_NO = BasicinfoEntities.ESIC_NO, PF_UNID_NUMBER = BasicinfoEntities.PF_UNID_NUMBER, INDUCTION = BasicinfoEntities.INDUCTION, IDENTIFICATION_MARK = BasicinfoEntities.IDENTIFICATION_MARK, LAST_MAJOR_ILLNESS_SURGERY = BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY, ALLERGY_HISTORY = BasicinfoEntities.ALLERGY_HISTORY, PHYSICAL_DISABILITY = BasicinfoEntities.PHYSICAL_DISABILITY, HIRING_TYPE = BasicinfoEntities.HIRING_TYPE, CV_TYPE = BasicinfoEntities.CV_TYPE, YEAR_OF_EXPERIENCE = BasicinfoEntities.YEAR_OF_EXPERIENCE, EXIT_DATE = BasicinfoEntities.EXIT_DATE, EXIT_TYPE = BasicinfoEntities.EXIT_TYPE, REFERENCE = BasicinfoEntities.REFERENCE, DEPARTMENT = BasicinfoEntities.DEPARTMENT, FULL_N_FINAL_STATUS = BasicinfoEntities.FULL_N_FINAL_STATUS, MOTHERTOUNGE = BasicinfoEntities.MOTHERTOUNGE, WORKLOCATION = BasicinfoEntities.WORKLOCATION, RELIGION = BasicinfoEntities.RELIGION, STATUS = "Active", }; //cache.Remove(CacheKey); _UOW.EMP_BASICINFORepository.Insert(bsicinfo); _UOW.Save(); TBL_EMP_TRANSFER_DETAILS tr = new TBL_EMP_TRANSFER_DETAILS(); tr.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); tr.DESIGNATION_ID = BasicinfoEntities.DESIGNATION; tr.WORK_LOCATION = BasicinfoEntities.WORKLOCATION; tr.DIVISION = BasicinfoEntities.DIVISION; tr.SUB_DIVISION = BasicinfoEntities.SUBDIVISION; tr.SECTION = BasicinfoEntities.SECTION; tr.DEPARTMENT = BasicinfoEntities.DEPARTMENT; tr.REPORTINGPERNAME = BasicinfoEntities.REPORTING_TO; tr.FROM_DATE = joiningdate; _UOW.TRANSFER_DETAILSMASTERRepository.Insert(tr); _UOW.Save(); status = Convert.ToInt32(bsicinfo.ID); } } catch (Exception ex) { log.Debug("Debug error logging", ex); log.Info("Info error logging", ex); log.Warn("Warn error logging", ex); log.Error("Error error logging", ex); log.Fatal("Fatal error logging", ex); var outputLines = new List <string>(); //foreach (var eve in ex.Message) //{ outputLines.Add(string.Format( "{0}: Entity of type \"{1}\" in state \"{2}\" has the following validation errors:", DateTime.Now, ex.Message, ex.StackTrace, ex.InnerException, ex.HelpLink)); //foreach (var ve in eve.ValidationErrors) //{ // outputLines.Add(string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage)); //} //} System.IO.File.AppendAllLines(@"D:\errors.txt", outputLines); } } return(status); }