private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfBTitleId.Value = Common.getMaxId("TrBudgetTitle", "BTitleId"); } DataTable dtMst = objDS.Tables["TrBudgetTitle"]; DataRow nRow = dtMst.NewRow(); nRow["BTitleId"] = Common.RoundDecimal(hfBTitleId.Value, 0); nRow["BTitleType"] = ddlBTitleType.SelectedValue; nRow["BTitle"] = txtBTitle.Text.ToString().Trim(); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsActive"] = chkIsActive.Checked == true ? "Y" : "N"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objTrMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrOtherTrain", "OtherTrainId"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrOtherTrain"]; DataRow nRow = dtMst.NewRow(); nRow["OtherTrainId"] = Common.RoundDecimal(hfId.Value, 0); nRow["TrainId"] = ddlTrainingName.SelectedValue.ToString().Trim(); nRow["StartDate"] = Common.ReturnDate(txtStrDate.Text.Trim()); nRow["EndDate"] = Common.ReturnDate(txtEndDate.Text.Trim()); nRow["Duration"] = Common.RoundDecimal(txtDuration.Text.Trim(), 0); nRow["OrganizedBy"] = ddlOrganizedBy.SelectedValue.ToString().Trim(); nRow["Remarks"] = txtRemarks.Text.ToString().Trim(); nRow["Location"] = txtLocation.Text.ToString().Trim(); nRow["Venue"] = txtVenue.Text.ToString().Trim(); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsCertificate"] = chkInActive.Checked == true ? "Y" : "N"; nRow["IsActive"] = chkInActive.Checked == true ? "N" : "Y"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrOtherTrainDtls"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; int DtlId = Int32.Parse(Common.getMaxId("TrOtherTrainDtls", "OtherTrainDtlId")); // //TraineeId,TraineeName foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["OtherTrainDtlId"] = DtlId; nRowdtl["OtherTrainId"] = Common.RoundDecimal(hfId.Value, 0);; nRowdtl["ParticipantName"] = row["ParticipantName"].ToString().Trim(); nRowdtl["Designation"] = row["Designation"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; DtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrTrainingYrPlan", "YrPlanId"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrTrainingYrPlan"]; DataRow nRow = dtMst.NewRow(); nRow["YrPlanId"] = Common.RoundDecimal(hfId.Value, 0); nRow["YrPlanName"] = txtPlanName.Text.Trim(); nRow["TrainId"] = Common.RoundDecimal(ddlTrainingName.SelectedValue.ToString().Trim(), 0); nRow["TrainType"] = txtTrainingType.Text.Trim(); nRow["TotalParticipant"] = Common.RoundDecimal(txtTotalParticipant.Text.Trim(), 0); nRow["Year"] = ddlYear.SelectedValue.ToString().Trim(); nRow["CourseFee"] = Common.RoundDecimal(txtCourseFee.Text.Trim(), 2); nRow["Perdiem"] = Common.RoundDecimal(txtPerdiem.Text.Trim(), 2); nRow["FAOthers"] = Common.RoundDecimal(txtFAOthers.Text.Trim(), 2); nRow["Transport"] = Common.RoundDecimal(txtTransport.Text.Trim(), 2); nRow["LocalTransport"] = Common.RoundDecimal(txtLocalTransport.Text.Trim(), 2); nRow["PracticalCost"] = Common.RoundDecimal(txtPracticalCost.Text.Trim(), 2); nRow["Miscellaneous"] = Common.RoundDecimal(txtMiscellaneous.Text.Trim(), 2); nRow["StrDate"] = Common.ReturnDate(txtStartDate.Text.Trim()); nRow["EndDate"] = Common.ReturnDate(txtEndDate.Text.Trim()); nRow["Duration"] = Common.RoundDecimal(txtDuration.Text.Trim(), 0); nRow["Remarks"] = txtRemarks.InnerText; //nRow["SubtitledBy"] = ddlSubtitledBy.SelectedValue.ToString().Trim(); var match = Regex.Match(txtSubtitledBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["SubtitledBy"] = empid; //nRow["ReviewedBy"] = ddlReviewedBy.SelectedValue.ToString().Trim(); match = Regex.Match(txtReviewedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["ReviewedBy"] = empid; //nRow["RecommBy1"] = ddlRecommend1.SelectedValue.ToString().Trim(); match = Regex.Match(txtRecommend1.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["RecommBy1"] = empid; //nRow["RecommBy2"] = ddlRecommend2.SelectedValue.ToString().Trim(); match = Regex.Match(txtRecommend2.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["RecommBy2"] = empid; //nRow["ApprovedBy"] = ddlApprovedBy.SelectedValue.ToString().Trim(); match = Regex.Match(txtApprovedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["ApprovedBy"] = empid; if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsActive"] = chkInActive.Checked == true ? "N" : "Y"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrTrainingYrPlanDtls"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; int DtlId = Int32.Parse(Common.getMaxId("TrTrainingYrPlanDtls", "YrPlanDtlsId")); foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["YrPlanDtlsId"] = DtlId; nRowdtl["YrPlanId"] = Common.RoundDecimal(hfId.Value, 0); nRowdtl["DesigId"] = row["DesigId"].ToString().Trim(); nRowdtl["FundedBy"] = row["FundedBy"].ToString().Trim(); nRowdtl["NoOfPerson"] = row["NoOfPerson"].ToString().Trim(); nRowdtl["VenueId"] = row["VenueId"].ToString().Trim(); nRowdtl["LocationId"] = row["LocationId"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; DtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrSchedule", "ScheduleID"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrSchedule"]; DataRow nRow = dtMst.NewRow(); nRow["ScheduleID"] = Common.RoundDecimal(hfId.Value, 0); nRow["TrainId"] = Common.RoundDecimal(ddlTrName.SelectedValue.ToString().Trim(), 0); nRow["SalLocId"] = ddlLocation.SelectedValue.ToString().Trim(); nRow["VenueId"] = ddlVenue.SelectedValue.ToString().Trim(); nRow["StrDate"] = Common.ReturnDate(txtStrDate.Text.Trim()); nRow["EndDate"] = Common.ReturnDate(txtEndDate.Text.Trim()); nRow["Duration"] = txtDuration.Text.Trim(); nRow["NoofPerson"] = txtNoOfPerson.Text.Trim(); var match = Regex.Match(txtCourseCordinator.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["CoordinatorName"] = empid; nRow["Residential"] = ddlResidential.SelectedValue.ToString().Trim(); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = (cmdType == "D" ? "Y" : "N"); nRow["IsActive"] = (chkInActive.Checked == true ? "N" : "Y"); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrScheduleDtls"]; DataTable dtDtlInput = ViewState["dtDtls"] as DataTable; int TrainListDtlId = Int32.Parse(Common.getMaxId("TrScheduleDtls", "ScheduleID")); foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["ScheduleID"] = Common.RoundDecimal(hfId.Value, 0); nRowdtl["FundedBy"] = row["Fundedby"].ToString().Trim(); nRowdtl["ParticipantNo"] = row["ParticipantNo"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; TrainListDtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrTrainingPlan", "TrainingPlanId"); } else { hfId.Value = hfId.Value; } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrTrainingPlan"]; DataRow nRow = dtMst.NewRow(); nRow["TrainingPlanId"] = Common.RoundDecimal(hfId.Value, 0); nRow["TrainId"] = Common.RoundDecimal(ddlTrainingName.SelectedValue.ToString().Trim(), 0); nRow["TentativeDate"] = Common.ReturnDate(txtTentativeDate.Text.Trim()); nRow["ParticipantLevel"] = Common.RoundDecimal(ddlParticipantLevel.SelectedValue.ToString().Trim(), 0); nRow["VenueId"] = Common.RoundDecimal(ddlVenue.SelectedValue.ToString().Trim(), 0); nRow["NoofParticipant"] = txtNoofParticipant.Text.Trim(); nRow["ParticipantMatrix"] = txtParticipantMatrix.Text.Trim(); nRow["Remarks"] = txtRemarks.Text.Trim(); var match = Regex.Match(txtCourseCoordinator.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["CourseCoordinator"] = empid; if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsActive"] = chkInActive.Checked == true ? "N" : "Y"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrTrainingPlanDtls"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; int DtlId = Int32.Parse(Common.getMaxId("TrTrainingPlanDtls", "TrainingPlanDtlId")); // //TraineeId,TraineeName,Designation,Dept,IsResidential,Fundedby foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["TrainingPlanDtlId"] = DtlId; nRowdtl["TrainingPlanId"] = Common.RoundDecimal(hfId.Value, 0); if (row["RespectiveResourceId"].ToString().Trim() != "-1") { nRowdtl["RespectiveResource"] = row["RespectiveResourceId"].ToString().Trim(); } else { nRowdtl["ExternalResource"] = row["RespectiveResourceName"].ToString().Trim(); } nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; DtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); DataTable dtDtlLevel = objDS.Tables["TrTrainingPlanLevelDtls"]; DataTable dtDtlLevelInput = ViewState["dtLevel"] as DataTable; int DtlLevelId = Int32.Parse(Common.getMaxId("TrTrainingPlanLevelDtls", "TrainingPlanLevelDtlId")); // //TraineeId,TraineeName,Designation,Dept,IsResidential,Fundedby foreach (DataRow row in dtDtlLevelInput.Rows) { DataRow nRowdtlLevel = dtDtlLevel.NewRow(); nRowdtlLevel["TrainingPlanLevelDtlId"] = DtlLevelId; nRowdtlLevel["TrainingPlanId"] = Common.RoundDecimal(hfId.Value, 0); nRowdtlLevel["NoOfParticipants"] = row["NoOfParticipants"].ToString().Trim(); nRowdtlLevel["FundedBy"] = row["FundedBy"].ToString().Trim(); nRowdtlLevel["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtlLevel["InsertedDate"] = DateTime.Now; DtlLevelId++; dtDtlLevel.Rows.Add(nRowdtlLevel); } dtDtlLevel.AcceptChanges(); tblList.Add(dtDtlLevel); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrTrainingBudget", "BudgetId"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrTrainingBudget"]; DataRow nRow = dtMst.NewRow(); nRow["BudgetId"] = Common.RoundDecimal(hfId.Value, 0); nRow["TrainId"] = Common.RoundDecimal(ddlTrainingName.SelectedValue.ToString().Trim(), 0); nRow["ScheduleID"] = Common.RoundDecimal(ddlTrainingSchedule.SelectedValue.ToString(), 0); nRow["VenueId"] = Common.RoundDecimal(ddlVenue.SelectedValue.ToString().Trim(), 0); nRow["CreateDate"] = Convert.ToDateTime(txtCreateDate.Text); //nRow["FundedBy"] = Common.RoundDecimal(txtFundedBy.Text.Trim(), 0); nRow["ParticipantLevel"] = txtParticipentLevel.Text.Trim(); nRow["TotalParticipant"] = Common.RoundDecimal(txtNoOfPerson.Text.Trim(), 0); nRow["Period"] = Common.RoundDecimal(hfDuration.Value, 0); //nRow["PreparedBy"] = txtPreparedBy.Text.Trim(); var match = Regex.Match(txtPreparedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["PreparedBy"] = empid; //nRow["ReviewedBy"] = txtReviewedBy.Text.Trim(); match = Regex.Match(txtReviewedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["ReviewedBy"] = empid; //nRow["RecomBy1"] = txtRecommend1.Text.Trim(); match = Regex.Match(txtRecommend1.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["RecomBy1"] = empid; //nRow["RecomBy2"] = txtRecommend2.Text.Trim(); match = Regex.Match(txtRecommend2.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["RecomBy2"] = empid; //nRow["RecomBy3"] = txtRecommend3.Text.Trim(); match = Regex.Match(txtRecommend3.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["RecomBy3"] = empid; //nRow["ApprovedBy"] = txtApprovedBy.Text.Trim(); match = Regex.Match(txtApprovedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["ApprovedBy"] = empid; if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsActive"] = chkInActive.Checked == true ? "N" : "Y"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrTrainingBudgetDtls"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; //int ResultDtlId = Int32.Parse(Common.getMaxId("TrTrainingBudgetDtls", "ResultDtlId")); //TraineeId,TraineeName,Designation,Dept,IsResidential,Fundedby foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["BudgetId"] = Common.RoundDecimal(hfId.Value, 0);; nRowdtl["BTitleId"] = row["BTitleId"].ToString().Trim(); nRowdtl["UnitCost"] = row["UnitCost"].ToString().Trim(); nRowdtl["ParticipantNo"] = row["ParticipantNo"].ToString().Trim(); nRowdtl["DaysNo"] = row["DaysNo"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); //ddlTrainingName.Items.Clear(); //ddlVenue.Items.Clear(); //ddlBTitleType.Items.Clear(); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrTrainingListSetup", "TrainListId"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrTrainingListSetup"]; DataRow nRow = dtMst.NewRow(); nRow["TrainListId"] = Common.RoundDecimal(hfId.Value, 0); nRow["ScheduleID"] = Common.RoundDecimal(ddlSchedule.SelectedValue.ToString().Trim(), 0); nRow["VenueId"] = ddlVenue.SelectedValue.ToString().Trim(); nRow["onDate"] = Common.ReturnDate(txtDate.Text.Trim()); nRow["onTime"] = tsTime.Hour + ":" + tsTime.Minute + " " + tsTime.AmPm; //nRow["SignBy1"] = ddlSignBy1.SelectedValue.ToString().Trim(); var match = Regex.Match(txtSignBy1.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignBy1"] = empid; //nRow["SignBy2"] = ddlSignBy2.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignBy2.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignBy2"] = empid; //nRow["SignBy3"] = ddlSignBy3.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignBy3.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignBy3"] = empid; nRow["CC"] = txtCC.Text.Trim(); nRow["AdminGuideline"] = txtAdminGuideline.Text.Trim(); //nRow["OrganizedBy"] = ddlOrganisedBy.SelectedValue.ToString().Trim(); match = Regex.Match(txtOrganisedBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["OrganizedBy"] = empid; nRow["Remarks"] = txtRemark.Text.Trim(); if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = (cmdType == "D" ? "Y" : "N"); nRow["IsActive"] = (chkInActive.Checked == true ? "N" : "Y"); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrTrainingListSetupDtl"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; int TrainListDtlId = Int32.Parse(Common.getMaxId("TrTrainingListSetupDtl", "TrainListDtlId")); foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["TrainListDtlId"] = TrainListDtlId; nRowdtl["TrainListId"] = Common.RoundDecimal(hfId.Value, 0);; nRowdtl["TraineeId"] = row["TraineeId"].ToString().Trim(); nRowdtl["FundedBy"] = row["Fundedby"].ToString().Trim(); nRowdtl["IsResidential"] = row["IsResidential"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; TrainListDtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
private void SaveData(string cmdType) { dsTraining objDS = new dsTraining(); if (cmdType == "I") { hfId.Value = Common.getMaxId("TrTrainResult", "ResultId"); } List <DataTable> tblList = new List <DataTable>(); DataTable dtMst = objDS.Tables["TrTrainResult"]; DataRow nRow = dtMst.NewRow(); nRow["ResultId"] = Common.RoundDecimal(hfId.Value, 0); nRow["ScheduleID"] = Common.RoundDecimal(ddlSchedule.SelectedValue.ToString().Trim(), 0); nRow["TrainId"] = Common.RoundDecimal(hfTrainingId.Value.ToString().Trim(), 0); nRow["EvalDate"] = Common.ReturnDate(txtEvaluationDate.Text.Trim()); nRow["EvalMethod"] = txtEvaluationMethod.Text.Trim(); //nRow["EvalBy"] = ddlEvaluationBy.SelectedValue.ToString().Trim(); var match = Regex.Match(txtEvaluationBy.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); string empid = match.Groups[match.Groups.Count - 1].Value; nRow["EvalBy"] = empid; //nRow["SignID1"] = ddlSignatory1.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignatory1.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignID1"] = empid; //nRow["SignID2"] = ddlSignatory2.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignatory2.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignID2"] = empid; //nRow["SignID3"] = ddlSignatory3.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignatory3.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignID3"] = empid; //nRow["SignID4"] = ddlSignatory4.SelectedValue.ToString().Trim(); match = Regex.Match(txtSignatory4.Text.Trim(), "(^(\\w+(.)*\\s)+\\[)*(\\w+)"); empid = match.Groups[match.Groups.Count - 1].Value; nRow["SignID4"] = empid; if (cmdType == "I") { nRow["InsertedBy"] = Session["USERID"].ToString().Trim(); nRow["InsertedDate"] = DateTime.Now; } else if (cmdType == "U") { nRow["UpdatedBy"] = Session["USERID"].ToString().Trim(); nRow["UpdatedDate"] = DateTime.Now; } nRow["IsDeleted"] = cmdType == "D" ? "Y" : "N"; nRow["IsActive"] = chkInActive.Checked == true ? "N" : "Y"; dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); tblList.Add(dtMst); //detail table DataTable dtDtl = objDS.Tables["TrTrainResultDtls"]; DataTable dtDtlInput = ViewState["dt"] as DataTable; int ResultDtlId = Int32.Parse(Common.getMaxId("TrTrainResultDtls", "ResultDtlId")); //TraineeId,TraineeName,Designation,Dept,IsResidential,Fundedby foreach (DataRow row in dtDtlInput.Rows) { DataRow nRowdtl = dtDtl.NewRow(); nRowdtl["ResultDtlId"] = ResultDtlId; nRowdtl["ResultId"] = Common.RoundDecimal(hfId.Value, 0);; nRowdtl["TraineeId"] = row["TraineeId"].ToString().Trim(); nRowdtl["FundedBy"] = row["Fundedby"].ToString().Trim(); nRowdtl["PreTest"] = row["PreTest"].ToString().Trim(); nRowdtl["PostTest"] = row["PostTest"].ToString().Trim(); nRowdtl["Viva"] = row["Viva"].ToString().Trim(); nRowdtl["PostTest"] = row["PostTest"].ToString().Trim(); nRowdtl["PracticalTest"] = row["PracticalTest"].ToString().Trim(); nRowdtl["Overall"] = row["Overall"].ToString().Trim(); nRowdtl["Remark"] = row["Remark"].ToString().Trim(); nRowdtl["Overall"] = row["Overall"].ToString().Trim(); nRowdtl["CompetencyLevel"] = row["CompetencyLevel"].ToString().Trim(); nRowdtl["InsertedBy"] = Session["USERID"].ToString().Trim(); nRowdtl["InsertedDate"] = DateTime.Now; ResultDtlId++; dtDtl.Rows.Add(nRowdtl); } dtDtl.AcceptChanges(); tblList.Add(dtDtl); try { objTrMgr.SaveMultiTableData(tblList, cmdType == "D" ? "U" : cmdType); lblMsg.Text = Common.GetMessage(cmdType); Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); //string s=string.parse(Convert.FromBase64String("WZNHp7Thsfhph2zxHz14FTd2PaSQ2rgAvoTpPtppgHjS0kfViSjeSjUuVsA8gpHS5SuDsxpJ49H6L9ISPJ574pbPin8S1")); } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }