protected bool SaveFinalContract() { TTSHWCFServiceClient cl = new TTSHWCFServiceClient(); List<SelectedCollborators_Details> lstSelCollab = new List<SelectedCollborators_Details>(); List<Selected_Clause_Details> lstSelClause = new List<Selected_Clause_Details>(); List<ContractDetails_MultipleContractFile> lstmultiple = new List<ContractDetails_MultipleContractFile>(); Contract_Details cd = new Contract_Details(); SelectedCollborators_Details scd = new SelectedCollborators_Details(); Selected_Clause_Details selcd = new Selected_Clause_Details(); ContractDetails_MultipleContractFile cdm = new ContractDetails_MultipleContractFile(); string result = ""; try { cd.i_ID = Convert.ToInt32(Common.iffBlank(HdnContractId.Value, 0)); cd.s_Contract_Display_Id = Convert.ToString(Common.iffBlank(TxtContractId.Text, "")); cd.s_Contract_Name = Convert.ToString(Common.iffBlank(TxtContractName.Text, "")); cd.i_Project_ID = Convert.ToInt32(HdnProjectId.Value); cd.i_Contract_Category_ID = Convert.ToInt32(Common.iffBlank(ddlContractCategory.SelectedValue, 0)); cd.i_Contract_Status_ID = Convert.ToInt32(Common.iffBlank(ddlContractStatus.SelectedValue, 0)); cd.dt_Contract_StatusDate = TxtContStartDate.Text == "" ? null : TxtContStartDate.Text; cd.i_Govt_Lawcountry = Convert.ToInt32(Common.iffBlank(HdnGovCountry.Value, 0)); cd.dt_LastUpdated_Date = TxtLastDate.Text == "" ? null : TxtLastDate.Text; cd.s_Clauses_File = Convert.ToString(Common.iffBlank((fldCorespondace.HasFile) ? String.Join(",", Common.UpLoadNew(fldCorespondace, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())) : hdnCoresPath.Value, "")); if (hdnCoresPath.Value.Length > 0) { cd.s_Clauses_File = (cd.s_Clauses_File != "") ? cd.s_Clauses_File : hdnCoresPath.Value; } cd.i_Hospital_Cost = Convert.ToDouble(Common.iffBlank(TxtprocedureCost.Text, 0)); cd.i_Investigator_fees = Convert.ToDouble(Common.iffBlank(TxtInvestigatorFees.Text, 0)); cd.i_Coordinator_fess = Convert.ToDouble(Common.iffBlank(TxtCoOrdinatorFess.Text, 0)); string[] arr = String.Join(",", chkCollaboratorList.Items.OfType<ListItem>().Where(r => r.Selected).Select(r => r.Value)).Split(','); for (int i = 0; i < arr.Length; i++) { lstSelCollab.Add(new SelectedCollborators_Details { i_Contract_Details_Id = 0, i_Collobrator_ID = Convert.ToInt32(arr[i]) }); } string[] ClausesVal = HdnClauseValues.Value.ToString().Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray(); for (int j = 0; j < ClausesVal.Length; j++) { lstSelClause.Add(new Selected_Clause_Details { i_Contract_ID = 0, i_Contract_Clause_ID = Convert.ToInt32(Common.iffBlank(ClausesVal[j].Split('|')[0], 0)), s_Status = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[1], "")), s_Comments = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[3], "")), s_Proposed_Changes = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[4], "")), }); } if (ddlContractStatus.SelectedItem.Text.ToLower() == "completed") { cd.dt_Effective_Date = TxtEffectiveDate.Text == "" ? null : TxtEffectiveDate.Text; cd.dt_Expiry_Date = TxtContractExpDate.Text == "" ? null : TxtContractExpDate.Text; cd.dt_Finalization_Date = TxtContractFinalizeDate.Text == "" ? null : TxtContractFinalizeDate.Text; cd.dt_LastSigned_Date = TxtDateofLast.Text == "" ? null : TxtDateofLast.Text; if (fldContractFile.HasFiles) { string[] multipleFiles = String.Join(",", Common.UpLoadNew(fldContractFile, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())).Split(','); for (int k = 0; k < multipleFiles.Length; k++) { lstmultiple.Add(new ContractDetails_MultipleContractFile { i_ContractDetailsID = 0, s_ContractFile = Convert.ToString(Common.iffBlank(multipleFiles[k], "")) }); } } if (HdnContractFiles.Value.Length > 0) { string[] files = HdnContractFiles.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < files.Length; i++) { lstmultiple.Add(new ContractDetails_MultipleContractFile { i_ContractDetailsID = 0, s_ContractFile = Convert.ToString(Common.iffBlank(files[i], "")) }); } } if (ddlAmendments.SelectedItem.Text.ToLower() == "yes") { cd.b_Amendments = Convert.ToInt32(Common.iffBlank(ddlAmendments.SelectedItem.Value, 0)) == 1 ? true : false; cd.dt_NewExpiry_Date = Convert.ToString(Common.iffBlank(TxtNContractExpiryDate.Text, "")); cd.s_AmendmenstContract_File = Convert.ToString(Common.iffBlank((fldAmendmentFile.HasFile) ? String.Join(",", Common.UpLoadNew(fldAmendmentFile, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())) : HdnAmendPath.Value, "")); if (HdnAmendPath.Value.Length > 0) { cd.s_AmendmenstContract_File = (cd.s_AmendmenstContract_File != "") ? cd.s_AmendmenstContract_File : HdnAmendPath.Value; } } } //--------UID and UName---- cd.UName = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserName"]), "").ToString(); cd.UID = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserID"]), "").ToString(); //----------- END ------------ result = cl.Contract_Details_DML(cd, lstSelCollab.ToArray(), lstSelClause.ToArray(), lstmultiple.ToArray(), HdnContractMode.Value); //} if (result.Split('|')[0].ToLower().Trim() == "success" && result.Split('|')[1].ToLower().CheckInt() == true) { switch (HdnContractMode.Value.ToLower()) { case "update": this.PopUpMsg("Contract Detail Update Successfully..!!", "AfterSave();"); break; case "delete": this.PopUpMsg("Contract Detail Delete Successfully..!!", "AfterSave();"); break; case "insert": this.PopUpMsg("Contract Detail Save Successfully..!!", "AfterSave();"); break; } btnResets_Click(null, null); btnContractSave.Text = "Save"; HdnContractId.Value = result.Split('|')[1]; //ClearContractControlAfterSave(); FillControl(); } else { this.MsgBox(result.Split('|')[1]); return false; } } //} //} catch (Exception ex) { this.MsgBox(ex.Message); return false; } return true; }
protected bool SaveFinalContract() { TTSHWCFServiceClient cl = new TTSHWCFServiceClient(); List <SelectedCollborators_Details> lstSelCollab = new List <SelectedCollborators_Details>(); List <Selected_Clause_Details> lstSelClause = new List <Selected_Clause_Details>(); List <ContractDetails_MultipleContractFile> lstmultiple = new List <ContractDetails_MultipleContractFile>(); Contract_Details cd = new Contract_Details(); SelectedCollborators_Details scd = new SelectedCollborators_Details(); Selected_Clause_Details selcd = new Selected_Clause_Details(); ContractDetails_MultipleContractFile cdm = new ContractDetails_MultipleContractFile(); string result = ""; try { cd.i_ID = Convert.ToInt32(Common.iffBlank(HdnContractId.Value, 0)); cd.s_Contract_Display_Id = Convert.ToString(Common.iffBlank(TxtContractId.Text, "")); cd.s_Contract_Name = Convert.ToString(Common.iffBlank(TxtContractName.Text, "")); cd.i_Project_ID = Convert.ToInt32(HdnProjectId.Value); cd.i_Contract_Category_ID = Convert.ToInt32(Common.iffBlank(ddlContractCategory.SelectedValue, 0)); cd.i_Contract_Status_ID = Convert.ToInt32(Common.iffBlank(ddlContractStatus.SelectedValue, 0)); cd.dt_Contract_StatusDate = TxtContStartDate.Text == "" ? null : TxtContStartDate.Text; cd.i_Govt_Lawcountry = Convert.ToInt32(Common.iffBlank(HdnGovCountry.Value, 0)); cd.dt_LastUpdated_Date = TxtLastDate.Text == "" ? null : TxtLastDate.Text; cd.s_Clauses_File = Convert.ToString(Common.iffBlank((fldCorespondace.HasFile) ? String.Join(",", Common.UpLoadNew(fldCorespondace, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())) : hdnCoresPath.Value, "")); if (hdnCoresPath.Value.Length > 0) { cd.s_Clauses_File = (cd.s_Clauses_File != "") ? cd.s_Clauses_File : hdnCoresPath.Value; } cd.i_Hospital_Cost = Convert.ToDouble(Common.iffBlank(TxtprocedureCost.Text, 0)); cd.i_Investigator_fees = Convert.ToDouble(Common.iffBlank(TxtInvestigatorFees.Text, 0)); cd.i_Coordinator_fess = Convert.ToDouble(Common.iffBlank(TxtCoOrdinatorFess.Text, 0)); string[] arr = String.Join(",", chkCollaboratorList.Items.OfType <ListItem>().Where(r => r.Selected).Select(r => r.Value)).Split(','); for (int i = 0; i < arr.Length; i++) { lstSelCollab.Add(new SelectedCollborators_Details { i_Contract_Details_Id = 0, i_Collobrator_ID = Convert.ToInt32(arr[i]) }); } string[] ClausesVal = HdnClauseValues.Value.ToString().Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray(); for (int j = 0; j < ClausesVal.Length; j++) { lstSelClause.Add(new Selected_Clause_Details { i_Contract_ID = 0, i_Contract_Clause_ID = Convert.ToInt32(Common.iffBlank(ClausesVal[j].Split('|')[0], 0)), s_Status = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[1], "")), s_Comments = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[3], "")), s_Proposed_Changes = Convert.ToString(Common.iffBlank(ClausesVal[j].Split('|')[4], "")), }); } if (ddlContractStatus.SelectedItem.Text.ToLower() == "completed") { cd.dt_Effective_Date = TxtEffectiveDate.Text == "" ? null : TxtEffectiveDate.Text; cd.dt_Expiry_Date = TxtContractExpDate.Text == "" ? null : TxtContractExpDate.Text; cd.dt_Finalization_Date = TxtContractFinalizeDate.Text == "" ? null : TxtContractFinalizeDate.Text; cd.dt_LastSigned_Date = TxtDateofLast.Text == "" ? null : TxtDateofLast.Text; if (fldContractFile.HasFiles) { string[] multipleFiles = String.Join(",", Common.UpLoadNew(fldContractFile, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())).Split(','); for (int k = 0; k < multipleFiles.Length; k++) { lstmultiple.Add(new ContractDetails_MultipleContractFile { i_ContractDetailsID = 0, s_ContractFile = Convert.ToString(Common.iffBlank(multipleFiles[k], "")) }); } } if (HdnContractFiles.Value.Length > 0) { string[] files = HdnContractFiles.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < files.Length; i++) { lstmultiple.Add(new ContractDetails_MultipleContractFile { i_ContractDetailsID = 0, s_ContractFile = Convert.ToString(Common.iffBlank(files[i], "")) }); } } if (ddlAmendments.SelectedItem.Text.ToLower() == "yes") { cd.b_Amendments = Convert.ToInt32(Common.iffBlank(ddlAmendments.SelectedItem.Value, 0)) == 1 ? true : false; cd.dt_NewExpiry_Date = Convert.ToString(Common.iffBlank(TxtNContractExpiryDate.Text, "")); cd.s_AmendmenstContract_File = Convert.ToString(Common.iffBlank((fldAmendmentFile.HasFile) ? String.Join(",", Common.UpLoadNew(fldAmendmentFile, Common.FolderLocation.ContractMgmtUser).Select(r => r.ToString())) : HdnAmendPath.Value, "")); if (HdnAmendPath.Value.Length > 0) { cd.s_AmendmenstContract_File = (cd.s_AmendmenstContract_File != "") ? cd.s_AmendmenstContract_File : HdnAmendPath.Value; } } } //--------UID and UName---- cd.UName = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserName"]), "").ToString(); cd.UID = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserID"]), "").ToString(); //----------- END ------------ result = cl.Contract_Details_DML(cd, lstSelCollab.ToArray(), lstSelClause.ToArray(), lstmultiple.ToArray(), HdnContractMode.Value); //} if (result.Split('|')[0].ToLower().Trim() == "success" && result.Split('|')[1].ToLower().CheckInt() == true) { switch (HdnContractMode.Value.ToLower()) { case "update": this.PopUpMsg("Contract Detail Update Successfully..!!", "AfterSave();"); break; case "delete": this.PopUpMsg("Contract Detail Delete Successfully..!!", "AfterSave();"); break; case "insert": this.PopUpMsg("Contract Detail Save Successfully..!!", "AfterSave();"); break; } btnResets_Click(null, null); btnContractSave.Text = "Save"; HdnContractId.Value = result.Split('|')[1]; //ClearContractControlAfterSave(); FillControl(); } else { this.MsgBox(result.Split('|')[1]); return(false); } } //} //} catch (Exception ex) { this.MsgBox(ex.Message); return(false); } return(true); }