public Operation DeleteCmnApprovalProcess(CmnApprovalProcess objCmnApprovalProcess) { Operation objOperation = new Operation { Success = true, OperationId = objCmnApprovalProcess.Id }; _CmnApprovalProcessRepository.Delete(objCmnApprovalProcess); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public ActionResult SaveApprovalProcess(CmnApprovalProcess approvalProcess) { int userId = Convert.ToInt32(Session["userId"]); Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { CmnApprovalProcess apvlProcess = new CmnApprovalProcess(); apvlProcess.Id = approvalProcess.Id; apvlProcess.SecModuleId = approvalProcess.SecModuleId; apvlProcess.Name = approvalProcess.Name; apvlProcess.ShortName = approvalProcess.ShortName; apvlProcess.Status = approvalProcess.Status; if (apvlProcess.Id == 0) { apvlProcess.CreatedBy = userId; apvlProcess.CreatedDate = DateTime.Now.Date; objOperation = _approvalProcessService.SaveCmnApprovalProcess(apvlProcess); } else { apvlProcess.ModifiedBy = userId; apvlProcess.ModifiedDate = DateTime.Now.Date; objOperation = _approvalProcessService.UpdateCmnApprovalProcess(apvlProcess); } } return Json(objOperation, JsonRequestBehavior.DenyGet); }
public Operation SaveCmnApprovalProcess(CmnApprovalProcess objCmnApprovalProcess) { Operation objOperation = new Operation { Success = true }; long Id = _CmnApprovalProcessRepository.AddEntity(objCmnApprovalProcess); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
private int CalculateTotalApproved(int companyId, int financialYear, int processId, int levelId, List<CmnApprovalProcessLevel> records, CmnApprovalProcess prcs) { int result = 0; //CmnProcessLevelBLL bll = new CmnProcessLevelBLL(); //Collection<CmnProcessLevel> records = bll.GetAll(companyId, EnumClass.DepartmentId, processId); //IList<int> pre = new List<int>(); //IList<int> post = new List<int>(); //int index = 0; //for (int i = 0; i < records.Count; i++) //{ // if (records[i].CmnProcessLevel.Id == levelId) // { // index = i; // } //} //for (int i = 0; i < records.Count; i++) //{ // if (index > i) // { // pre.Add((int)records[i].CmnProcessLevel.Id); // } // else if (index < i) // { // post.Add((int)records[i].CmnProcessLevel.Id); // } //} string sqlText = string.Empty; sqlText += "SELECT COUNT(*) FROM CmnApprovals "; sqlText += "WHERE ((Value IS NULL) OR (Value = 0)) AND (CmnCompanyId = " + companyId.ToString() + ") AND (CmnProcessLevelId = " + levelId.ToString() + ") AND (CmnApprovalProcessId = " + processId.ToString() + ") "; //foreach (int i in pre) //{ // string lvlId = "pre" + i.ToString(); // sqlText += "AND 1="; // sqlText += "("; // sqlText += "SELECT Value FROM CmnApprovals as " + lvlId + " "; // sqlText += "WHERE (" + lvlId + ".CmnApprovalProcessId = " + processId.ToString() + ") AND (" + lvlId + ".CmnProcessLevelId = " + i.ToString() + ") AND (" + lvlId + ".CmnCompanyId = " + companyId.ToString() + ") AND (Value = 1) AND " + lvlId + ".RefId=CmnApprovals.RefId"; // sqlText += ") "; //} //foreach (int i in post) //{ // string lvlId = "post" + i.ToString(); // sqlText += "AND 0="; // sqlText += "("; // sqlText += "SELECT Value FROM CmnApprovals as " + lvlId + " "; // sqlText += "WHERE (" + lvlId + ".CmnApprovalProcessId = " + processId.ToString() + ") AND (" + lvlId + ".CmnProcessLevelId = " + i.ToString() + ") AND (" + lvlId + ".CmnCompanyId = " + companyId.ToString() + ") AND (Value = 0) AND " + lvlId + ".RefId=CmnApprovals.RefId"; // sqlText += ") "; //} //sqlText += "AND RefId IN (SELECT Id FROM " + prcs.TableName + " WHERE CmnFinancialYearId=" + financialYear + " and IsCancel=0)"; //result = new CmnApprovalBLL().GetNoOfUnposted(sqlText); result=_cmnApprovalService.GetNoOfUnposted(sqlText); return result; }