public void UpdateExecutiveReporting(ExecutiveReporting Executive) { Executive.Deactivate = "Y"; Executive.ModifiedBy = null; Executive.ModifiedDate = null; Executive.DeactivateBy = Executive.EnteredBy; Executive.DeactivateDate = DateTime.Now; _ExecutiveReporting.Update(Executive); }
public void InsertExecutiveReporting(ExecutiveReporting Executive) { Executive.Deactivate = "N"; Executive.EntryDate = DateTime.Now; Executive.ModifiedBy = null; Executive.ModifiedDate = null; Executive.DeactivateBy = null; Executive.DeactivateDate = null; _ExecutiveReporting.Insert(Executive); }
public void DeavtivateExecutiveReporting(int id, int enteredBy) { ExecutiveReporting Reporting = getExecutiveReporting(id); if (Reporting != null) { Reporting.Deactivate = "Y"; Reporting.DeactivateDate = DateTime.Now; Reporting.DeactivateBy = enteredBy; _ExecutiveReporting.Update(Reporting); } }
//Added by Saddam/ public IHttpActionResult ExecutiveDelete(ExecutiveMaster _executive) { string status = string.Empty; try { //worked temporary modifty after further process has done ExecutiveMaster _Executive = new ExecutiveMaster(); if (_executive.ProcessTransferTo != 0) { //_Executive = _ExecutiveService.GetExecutiveById(_executive.ProcessTransferTo); //_Executive.ModifiedBy = _executive.EnteredBy; //_Executive.ModifiedDate = DateTime.Now; //_Executive.ProcessTransferTo = _executive.Id; //_ExecutiveService.UpdateExecutive(_Executive); IList <ExecutiveReporting> _repotingList = _ExecutiveService.GetRepotingListById(_executive.Id); if (_repotingList.Count > 0) { foreach (var items in _repotingList) { //--delete repoting to who executive is deleted ExecutiveReporting mobj_repoting = _ExecutiveService.getExecutiveReporting(items.executiveid); _ExecutiveService.UpdateExecutiveReporting(mobj_repoting); //--insert repoting to for which executive is deleted ExecutiveReporting Reporting = new ExecutiveReporting(); Reporting.executiveid = items.executiveid; Reporting.reportingidto = _executive.ProcessTransferTo; Reporting.EnteredBy = _executive.EnteredBy; _ExecutiveService.InsertExecutiveReporting(Reporting); } } //--set executive repoting to or not ExecutiveMaster mobj_Excutive = _ExecutiveService.GetExecutiveById(_executive.ProcessTransferTo); mobj_Excutive.ProcessTransferTo = 1; _ExecutiveService.UpdateExecutive(mobj_Excutive); //------------------------- } _Executive = _ExecutiveService.GetExecutiveById(_executive.Id); //_Executive.Deactivate = "Y"; _Executive.block = "Y"; //for only restrict login _Executive.ModifiedBy = _executive.EnteredBy; _Executive.ModifiedDate = DateTime.Now; _Executive.ProcessTransferTo = 0; _ExecutiveService.UpdateExecutive(_Executive); status = "OK"; } catch (ACSException ex) { status = ex.InnerException.Message; } catch (Exception ex) { status = ex.InnerException.Message; } return(Json(status)); }
//Added by Saddam/ public IHttpActionResult insertExecutive(ExecutiveModel Executive) { string status = ""; using (TransactionScope scope = new TransactionScope()) { try { ExecutiveMaster _Executive = new ExecutiveMaster(); _Executive.executiveName = Executive.executiveName; _Executive.executivecode = Executive.executivecode; _Executive.Emailid = Executive.Emailid; _Executive.DepartmentId = Executive.DepartmentId; _Executive.Mobile = Executive.Mobile; _Executive.Phoneno = Executive.Phoneno; _Executive.DepartmentId = Executive.DepartmentId; _Executive.Password = _encryptionService.EncryptText(Executive.Password, _ExecutiveService.KeyValue("encriptionkey")); _Executive.Id = Executive.Id; _Executive.EnteredBy = Executive.EnteredBy; // status = _ExecutiveService.DuplicityCheck(_Executive); status = _ExecutiveService.DuplicityExecutiveCodeCheck(_Executive); if (status == "Y") { if (Executive.Id == 0) { int ExecutiveIdId = _ExecutiveService.InsertExecutive(_Executive); if (ExecutiveIdId != 0) { ExecutiveDivisionLink Link = new ExecutiveDivisionLink(); foreach (var item in Executive.Division) { Link.executiveid = ExecutiveIdId; Link.divisionid = item; Link.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveDivisionLinking(Link); } } if (Executive.ReportingId != 0 && ExecutiveIdId != 0 && Executive.RoleName == "executive") { ExecutiveReporting Reporting = new ExecutiveReporting(); Reporting.executiveid = ExecutiveIdId; Reporting.reportingidto = Executive.ReportingId; Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveReporting(Reporting); } } else { ExecutiveMaster mobj_Excutive = _ExecutiveService.GetExecutiveById(_Executive.Id); //_ExecutiveService.GetDivisionById(Executive); mobj_Excutive.executiveName = Executive.executiveName; mobj_Excutive.executivecode = Executive.executivecode; mobj_Excutive.Emailid = Executive.Emailid; mobj_Excutive.Password = _encryptionService.EncryptText(Executive.Password, _ExecutiveService.KeyValue("encriptionkey")); mobj_Excutive.Mobile = Executive.Mobile; mobj_Excutive.Phoneno = Executive.Phoneno; mobj_Excutive.DepartmentId = Executive.DepartmentId; mobj_Excutive.ModifiedBy = Executive.EnteredBy; mobj_Excutive.ModifiedDate = System.DateTime.Now; _ExecutiveService.UpdateExecutive(mobj_Excutive); ExecutiveDivisionLink Link = new ExecutiveDivisionLink(); _ExecutiveService.DeactivateExecutiveDivisionLinking(Executive.Id, Executive.EnteredBy); foreach (var item in Executive.Division) { Link.executiveid = Executive.Id; Link.divisionid = item; Link.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveDivisionLinking(Link); } if (Executive.ReportingId != 0) { _ExecutiveService.DeavtivateExecutiveReporting(Executive.Id, Executive.EnteredBy); ExecutiveReporting Reporting = new ExecutiveReporting(); Reporting.executiveid = Executive.Id; if (Executive.RoleName == "executive") { Reporting.reportingidto = Executive.ReportingId; Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveReporting(Reporting); } else { Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.UpdateExecutiveReporting(Reporting); } } } //--set executive repoting to or not if (Executive.ReportingId != 0) { ExecutiveMaster mobj_Excutive = _ExecutiveService.GetExecutiveById(Executive.ReportingId); mobj_Excutive.ProcessTransferTo = Executive.ProcessTransferTo; _ExecutiveService.UpdateExecutive(mobj_Excutive); } //------------------------- status = _localizationService.GetResource("Master.API.Success.Message"); scope.Complete(); } else { status = "Duplicate"; } } catch (ACSException ex) { status = ex.InnerException.Message; } catch (Exception ex) { status = ex.InnerException.Message; } } return(Json(status)); }