public string addremark(string remark) { string rmrk = ""; try { if (remark.Contains("-")) { string[] str = remark.Split('-'); rmrk = Login.userLoggedInName + "-" + UpdateTable.getSQLDateTime() + "-" + str[2]; } else { rmrk = Login.userLoggedInName + "-" + UpdateTable.getSQLDateTime() + "-" + txtRemarks.Text; } } catch (Exception ex) { } return(rmrk); }
private void SetResidence_Click(object sender, RoutedEventArgs e) { if (this.AddressListViewer.SelectedItem == null) { MessageBox.Show("Please select an address", "No Address Selected", MessageBoxButton.OK, MessageBoxImage.Error); return; } var list = this.AddressListViewer.Items; foreach (Address a in list) { UpdateTable.UpdateEmployeeAddress( new EmployeeAddress { Bsn = this._employee.Bsn, PostalCode = a.PostalCode, Country = a.Country }, new EmployeeAddress { Bsn = this._employee.Bsn, PostalCode = a.PostalCode, Country = a.Country, IsResidence = false }); } UpdateTable.UpdateEmployeeAddress( new EmployeeAddress { Bsn = this._employee.Bsn, PostalCode = this.AddressListViewer.SelectedItem.PostalCode, Country = this.AddressListViewer.SelectedItem.Country }, new EmployeeAddress { Bsn = this._employee.Bsn, PostalCode = this.AddressListViewer.SelectedItem.PostalCode, Country = this.AddressListViewer.SelectedItem.Country, IsResidence = true }); this.ShowResidence(); }
private void initVariables() { try { lbldatetime.Text = UpdateTable.getSQLDateTime().Date.ToString("dd-MM-yyyy"); int count = grdList.RowCount; lblOffice.Visible = false; cmbfilterOffice.Visible = false; lbldatetime.Visible = false; lbldate.Visible = false; dtpdate.Visible = false; pnlEditButtons.Visible = false; if (Main.itemPriv[2]) { pnlEditButtons.Visible = true; OfficeDB.fillOfficeComboNew(cmbfilterOffice); lblOffice.Visible = true; cmbfilterOffice.Visible = true; lbldate.Visible = true; dtpdate.Visible = true; dtpdate.Format = DateTimePickerFormat.Custom; dtpdate.CustomFormat = "dd-MM-yyyy"; dtpdate.Enabled = true; dtpdate.Value = UpdateTable.getSQLDateTime(); } else { if (grdList.RowCount > 0 && UpdateTable.getSQLDateTime().Hour < 11) { pnlEditButtons.Visible = true; } lbldatetime.Visible = true; } emplOfficeID = EmployeeDB.getEmployeeOffice(Login.empLoggedIn); } catch (Exception) { } }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { int Rows, Cols, ASpeed; if (!String.IsNullOrEmpty(txtName.Text)) { if (int.TryParse(txtRows.Text, out Rows)) { if (int.TryParse(txtCols.Text, out Cols)) { if (int.TryParse(txtAnimationSpeed.Text, out ASpeed)) { StartPoint.IsChecked = true; UpdateTable?.Invoke(null, new UpdateTableEventArgs() { RowCount = Rows, ColCount = Cols, AnimationSpeed = ASpeed, UncertaintyLevel = slider.Value, BackPathType = (Shortest.IsChecked == true) ? BackPathType.Shortest : BackPathType.Reversed, Title = txtName.Text }); } } } } }
private void lvOK_Click5(object sender, EventArgs e) { try { //pnllv.Visible = true; if (txt.Text.Trim().Length == 0) { MessageBox.Show("Please Add Comment"); return; } txtRemarks.Text = txtRemarks.Text + Environment.NewLine + Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("dd-MM-yyyy HH:mm:ss") + " : " + txt.Text; //btnAddComment.Enabled = true; //pnllv.Visible = false; txtRemarks.ReadOnly = true; ContextMenu blankContextMenu = new ContextMenu(); txtRemarks.ContextMenu = blankContextMenu; frmPopup.Close(); frmPopup.Dispose(); } catch (Exception ex) { } }
private void ListEmployee() { try { grdList.Visible = true; grdList.Rows.Clear(); AttendanceDB dbrecord = new AttendanceDB(); List <attendance> emplist = new List <attendance>(); List <attendance> empleavelist = new List <attendance>(); List <attendance> empbiolist = new List <attendance>(); List <attendance> empMRlist = new List <attendance>(); int opt = 0; empstatuslist = new List <attendance>(); if (Main.itemPriv[2]) { if (cmbfilterOffice.SelectedIndex != -1) { string officeid = ((Structures.ComboBoxItem)cmbfilterOffice.SelectedItem).HiddenValue; emplist = dbrecord.getEmployeeListforoffice(officeid).OrderBy(x => x.EmployeeName).ToList(); if (dtpdate.Value.Date <= UpdateTable.getSQLDateTime().Date) { empstatuslist = dbrecord.getEmployeestatusListforoffice(officeid, dtpdate.Value); if (empstatuslist.Count == 0) { empleavelist = dbrecord.getEmployeeLeaveList(dtpdate.Value); empbiolist = dbrecord.getEmployeeBiometricList(dtpdate.Value); empMRlist = dbrecord.getMrEmployeeList(dtpdate.Value); } } else if (dtpdate.Value.Date > UpdateTable.getSQLDateTime().Date) { pnlEditButtons.Visible = false; MessageBox.Show("Please select the date equal to or less than today!!!"); return; } } } else { emplist = dbrecord.getEmployeeList().OrderBy(x => x.EmployeeName).ToList(); empstatuslist = dbrecord.getEmployeestatusListforoffice(emplOfficeID, UpdateTable.getSQLDateTime()); if (empstatuslist.Count == 0) { empleavelist = dbrecord.getEmployeeLeaveList(UpdateTable.getSQLDateTime()); empbiolist = dbrecord.getEmployeeBiometricList(UpdateTable.getSQLDateTime()); empMRlist = dbrecord.getMrEmployeeList(UpdateTable.getSQLDateTime()); } } foreach (attendance elst in emplist) { grdList.Rows.Add(); int kount = grdList.RowCount; grdList.Rows[kount - 1].Cells["RowID"].Value = kount; grdList.Rows[kount - 1].Cells["EmployeeID"].Value = Convert.ToInt32(elst.EmployeeID); grdList.Rows[kount - 1].Cells["EmployeeName"].Value = elst.EmployeeName; DataGridViewComboBoxCell cmbAttendanceStatus = (DataGridViewComboBoxCell)(grdList.Rows[kount - 1].Cells["AttendanceStatus"]); CatalogueValueDB.fillCatalogValueGridViewComboNew(cmbAttendanceStatus, "AttendanceStatus"); attendance empstatlst = empstatuslist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); if (empstatlst == null) { attendance emplvlst = empleavelist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); attendance empbiolst = empbiolist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); attendance empMRlst = empMRlist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); if (emplvlst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "Leave"; Initval.Add(emplvlst.EmployeeID, "Leave"); changedval.Add(emplvlst.EmployeeID, "Leave"); } else { if (empbiolst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "Present"; Initval.Add(empbiolst.EmployeeID, "Present"); changedval.Add(empbiolst.EmployeeID, "Present"); } else if (empMRlst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "LocalTravel"; Initval.Add(empMRlst.EmployeeID, "LocalTravel"); changedval.Add(empMRlst.EmployeeID, "LocalTravel"); } } } else { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = empstatlst.AttendenceStatus; Initval.Add(empstatlst.EmployeeID, empstatlst.AttendenceStatus); } } pnlEditButtons.Visible = false; if (!Main.itemPriv[2]) { if (grdList.RowCount > 0 && UpdateTable.getSQLDateTime().Hour < 13) { pnlEditButtons.Visible = true; } } else if (grdList.RowCount > 0) { pnlEditButtons.Visible = true; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } enableBottomButtons(); pnlMenuList.Visible = true; }
private void btnSave_Click_1(object sender, EventArgs e) { Boolean status = true; try { StockOBNewDB sobDB = new StockOBNewDB(); stockObNewHeader sobh = new stockObNewHeader(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; if (!verifyAndReworkAccGridRows()) { MessageBox.Show("Error found in StockOB details. Please correct before updating the details"); return; } try { sobh.DocumentID = docID; sobh.FYID = cmbFYID.SelectedItem.ToString().Trim().Substring(0, cmbFYID.SelectedItem.ToString().Trim().IndexOf(':')).Trim(); //sobh.StoreLocation = cmbStoreLocation.SelectedItem.ToString().Substring(0, cmbStoreLocation.SelectedItem.ToString().IndexOf('-')); sobh.StoreLocation = ((Structures.ComboBoxItem)cmbStoreLocation.SelectedItem).HiddenValue; sobh.Remarks = txtRemarks.Text; sobh.Value = Convert.ToDouble(txtcredittotal.Text); } catch (Exception ex) { MessageBox.Show("Validation failed"); status = false; return; } if (btnText.Equals("Save")) { // sobh.DocumentNo = DocumentNumberDB.getNewNumber(docID, 1); sobh.DocumentStatus = 1; sobh.DocumentDate = UpdateTable.getSQLDateTime(); } else { sobh.DocumentNo = Convert.ToInt32(txtDocNo.Text); sobh.DocumentStatus = prevsboh.DocumentStatus; sobh.DocumentDate = prevsboh.DocumentDate; } if (!sobDB.validateStockOB(sobh)) { MessageBox.Show("Validation Failed"); status = false; return; } if (btnText.Equals("Save")) { if (!sobDB.verifyFYLoc(sobh.FYID, sobh.StoreLocation)) { MessageBox.Show("For this Financial Year and Location Document already Available.Reenter not allow."); return; } List <stockObNewDetail> StockList = getStockOBDetails(sobh); if (sobDB.InsertStockHeaderAndDetail(sobh, StockList)) { MessageBox.Show("Details Added"); closeAllPanels(); listOption = 1; FilteredStockOBList(listOption); pnlAddEdit.Visible = false; } else { MessageBox.Show("Failed to insert StockOB Detail"); status = false; } if (!status) { MessageBox.Show("Failed to Insert"); status = false; } } else if (btnText.Equals("Update")) { List <stockObNewDetail> StockList = getStockOBDetails(sobh); if (sobDB.updateStockHeaderAndDetail(sobh, StockList)) { MessageBox.Show(" details updated"); closeAllPanels(); listOption = 1; FilteredStockOBList(listOption); } else { status = false; } if (!status) { MessageBox.Show("Failed to update"); } } else { MessageBox.Show("Validation failed"); status = false; } } catch (Exception ex) { MessageBox.Show("Validation failed"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }
private void btnSave_Click(object sender, EventArgs e) { Boolean status = true; try { TapalPickDB agdb = new TapalPickDB(); tapal tap = new tapal(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; try { //if (!System.Text.RegularExpressions.Regex.IsMatch(txtFileName.Text, @"^[0-9]+$")) //{ // MessageBox.Show("Group Code accepts only numeric characters"); // return; //} //else tap.DocumentID = docID; tap.Date = UpdateTable.getSQLDateTime(); tap.ReceivedFrom = txtReceivedFrom.Text.Trim(); tap.Description = txtDescription.Text.Trim(); tap.FileName = Path.GetFileName(txtFileName.Text); tap.InwardDocumentType = cmbInwardDocType.SelectedItem.ToString(); if (cmbInwardDocType.SelectedIndex == -1) { MessageBox.Show("Enter InwardDocumentType."); return; } string nm = Path.GetFileName(txtFileName.Text); //if (!System.Text.RegularExpressions.Regex.IsMatch(txtFileDesc.Text, @"^[\sa-zA-Z0-9]+$")) //{ // MessageBox.Show("GroupInwardDocumentType accepts only alphanumeric characters"); // return; //} //else byte[] byteArray = null; FileStream fs = new FileStream(txtFileName.Text, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); tap.DocumentContent = Convert.ToBase64String(br.ReadBytes((int)fs.Length)); } catch (Exception ex) { MessageBox.Show("Validation failed"); return; } if (btnText.Equals("Save")) { if (agdb.validateTapal(tap)) { if (agdb.inserttapal(tap)) { MessageBox.Show("Tapal Added"); closeAllPanels(); listtapal(); pnlAddNew.Visible = false; grdList.Visible = true; pnlBottomButtons.Visible = true; } else { status = false; } } else { MessageBox.Show("Validation failed"); } if (!status) { MessageBox.Show("Failed to save Tapal Document"); } } else { MessageBox.Show("btnSave error."); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
private void initVariables() { closeAllPanels(); label1.Text = UpdateTable.getSQLDateTime().ToString("dd-MM-yyyy"); }
public static SqlBuilder Update(this RowData row, bool OnlyChanges = false, bool OutputPrimaryKey = false, string[] OutputFields = null) { if (OnlyChanges && !row.HasChanges) { return(null); } SqlBuilder builder = SqlBuilder.Update(); string TableName = row.Table; string Schema = null; if (TableName.IndexOf('.') > 0) { Schema = TableName.Substring(0, TableName.IndexOf('.')); TableName = TableName.Substring(TableName.IndexOf('.') + 1); } UpdateTable up = builder.Table(TableName, Schema); Metadata.MetadataTable mt = row.Metadata; if (OnlyChanges) { foreach (string key in row.ChangedValues.Keys) { object o; MetadataColumn c; if (row.ChangedValues.TryGetValue(key, out o) && mt.Columns.TryGetValue(key, out c) && !c.IsReadOnly) { SqlStatementExtensions.Set(up, key, o, c.SqlDataType, c.DataType, c.Length, c.Precision, c.Scale); } else { throw new InvalidOperationException("Cannot get the changed column " + key); } } } else { foreach (string key in row.Columns) { MetadataColumn c; if (mt.Columns.TryGetValue(key, out c) && !c.IsReadOnly) { SqlStatementExtensions.Set(up, key, row.Column(key), c.SqlDataType, c.DataType, c.Length, c.Precision, c.Scale); } } } if (OutputPrimaryKey) { TableParameterField tpf = up.Output(); foreach (MetadataColumn key in mt.PrimaryKey.Columns) { SqlStatementExtensions.Column(tpf, key.Name, key.SqlDataType, key.Length, key.Precision, key.Scale); } } if (OutputFields != null && OutputFields.Length > 0) { TableParameterField tpf = up.Output(); foreach (string s in OutputFields) { MetadataColumn c = mt[s]; SqlStatementExtensions.Column(tpf, s, c.SqlDataType, c.Length, c.Precision, c.Scale); } } builder.WhereConditions = row.PrimaryKey(builder); return(builder); }
public ClassController(UpdateTable form2) { this.form2 = form2; }
private void UpdateButton_Click(object sender, EventArgs e) { UpdateTable?.Invoke(sender, EventArgs.Empty); }
private void grdProcessDetail_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdProcessDetail.Columns[e.ColumnIndex].Name; if (columnName.Equals("Start") || columnName.Equals("End") || columnName.Equals("Remark")) { prevProdDetail = new productionplandetail(); prevProdDetail.DocumentID = "PRODUCTIONPLAN"; prevProdDetail.TemporaryNo = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["cTempNo"].Value); prevProdDetail.TemporaryDate = Convert.ToDateTime(grdProcessDetail.Rows[e.RowIndex].Cells["cTempDate"].Value); prevProdDetail.SlNo = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["SiNo"].Value); prevProdDetail.ProcessStatus = getProcessStatCode(grdProcessDetail.Rows[e.RowIndex].Cells["ProcessStatus"].Value.ToString()); prevProdDetail.Remarks = grdProcessDetail.Rows[e.RowIndex].Cells["cRemarks"].Value.ToString(); int prodstat = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["ProdStat"].Value); if (columnName == "Start") { //if (!ProductionPlanHeaderDB.checkProductionProcessStatusAgainstRawmaterialIssue(prevProdDetail, prevProdDetail.TemporaryNo.ToString(), prevProdDetail.TemporaryDate)) //{ // MessageBox.Show("Raw Material Usage Not Finalized For this Production Plan.\nPlease update Process After finalizing RawMaterial Usage."); // return; //} Boolean isUpdateProdStat = false; if (prodstat == 1) // prodstat == 1 : Not started prodstat != 1 : started { isUpdateProdStat = true; } else { isUpdateProdStat = false; } if (prevProdDetail.ProcessStatus == 1) { MessageBox.Show("Production already Started."); return; } if (prevProdDetail.ProcessStatus == 99) { MessageBox.Show("Production already Closed."); return; } prevProdDetail.ActualStartTime = UpdateTable.getSQLDateTime(); string cmnt = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("yyyy-MM-dd HH:mm:ss") + " : " + "Process started" + Environment.NewLine; prevProdDetail.Remarks = prevProdDetail.Remarks + cmnt; DialogResult dialog = MessageBox.Show("Are you sure to Start the process ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ProductionPlanHeaderDB.updateProductionProcessStatus(prevProdDetail, 1, isUpdateProdStat)) { MessageBox.Show("Production Started"); if (isUpdateProdStat) { prodstat = 2; } } else { MessageBox.Show("Failed to production start"); } } } if (columnName == "End") { if (prevProdDetail.ProcessStatus == 0) { MessageBox.Show("Production not started."); return; } if (prevProdDetail.ProcessStatus == 99) { MessageBox.Show("Production already closed."); return; } if (!ProductionPlanHeaderDB.checkProductionProcessStatusAgainstRawmaterialIssue(prevProdDetail, prevProdDetail.TemporaryNo.ToString(), prevProdDetail.TemporaryDate)) { MessageBox.Show("Raw Material Usage Not Finalized For this Production Plan.\nPlease update Process After finalizing RawMaterial Usage."); return; } string cmnt = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("yyyy-MM-dd HH:mm:ss") + " : " + "Process closed" + Environment.NewLine; prevProdDetail.Remarks = prevProdDetail.Remarks + cmnt; prevProdDetail.ActualEndTime = UpdateTable.getSQLDateTime(); DialogResult dialog = MessageBox.Show("Are you sure to Close the process ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ProductionPlanHeaderDB.updateProductionProcessStatus(prevProdDetail, 2, false)) { MessageBox.Show("Production closed"); } else { MessageBox.Show("Failed to production close"); } } } if (columnName == "Remark") { showPopUpForDescription(); } productionplanheader pph = new productionplanheader(); pph.DocumentID = "PRODUCTIONPLAN"; pph.TemporaryNo = prevProdDetail.TemporaryNo; pph.TemporaryDate = prevProdDetail.TemporaryDate; pph.ProductionStatus = prodstat; showProcessDetails(pph); } } catch (Exception ex) { } }
private void btnSave_Click(object sender, EventArgs e) { Boolean status = true; try { List <smrnservicedlist> SMRNServList; SMRNServicedListDB ServListDB = new SMRNServicedListDB(); smrnservicedlist ServList = new smrnservicedlist(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; try { ServList.DocumentID = docID; smrnservicedlist smrnserv; SMRNServList = new List <smrnservicedlist>(); for (int i = 0; i < grdSMRNServList.Rows.Count; i++) { try { DataGridViewCheckBoxCell cell = grdSMRNServList.Rows[i].Cells["check"] as DataGridViewCheckBoxCell; if (cell.Value != null) { if (Convert.ToBoolean(cell.Value) == true) { smrnserv = new smrnservicedlist(); smrnserv.SMRNHeaderNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gSMRNHeaderNo"].Value.ToString().Trim()); smrnserv.SMRNHeaderDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gSMRNHeaderDate"].Value.ToString().Trim()); smrnserv.JobIDNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["JobId"].Value.ToString().Trim()); smrnserv.ListNo = Convert.ToInt32(grdSMRNServList.Rows[i].Cells["gTemporaryNo"].Value.ToString().Trim()); /// For storing TemporaryNo of SMRNDetail smrnserv.ListDate = Convert.ToDateTime(grdSMRNServList.Rows[i].Cells["gTemporaryDate"].Value.ToString().Trim()); ////for storing temporaryDate of SMRNdetail SMRNServList.Add(smrnserv); } } } catch (Exception ex) { MessageBox.Show("createAndUpdateSMRNDetails() : Error creating SMRN Details"); status = false; return; } } ServList.Status = 1; } catch (Exception ex) { MessageBox.Show("Validation failed"); return; } if (btnText.Equals("Save")) { ServList.ListNo = DocumentNumberDB.getNewNumber(docID, 1); ServList.DocumentStatus = 1; ServList.ListDate = UpdateTable.getSQLDateTime(); } else { ServList.ListNo = Convert.ToInt32(txtListNo.Text); ServList.DocumentStatus = prevservlist.DocumentStatus; ServList.ListDate = prevservlist.ListDate; } if (btnText.Equals("Save")) { if (ServListDB.updateSMRNServicedList(ServList, SMRNServList, 1)) { MessageBox.Show("SMRNService List Details Added"); closeAllPanels(); listOption = 1; ListFilteredSMRNServiceList(listOption); } else { status = false; } if (!status) { MessageBox.Show("Failed to Insert SMRNServiceList"); status = false; } } else { MessageBox.Show("SMRNServiceList Validation failed"); status = false; } } catch (Exception ex) { MessageBox.Show("SMRNServiceList Validation failed"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }
private void btnSave_Click(object sender, EventArgs e) { Boolean status = true; try { ProductTestTemplateDB PTTempDB = new ProductTestTemplateDB(); producttesttemplateheader ptlist = new producttesttemplateheader(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; try { ptlist.DocumentID = docID; ptlist.StockItemID = txtStockItemId.Text.Substring(0, txtStockItemId.Text.IndexOf('-')); ptlist.ModelNo = txtModelNo.Text; ptlist.ModelName = txtModelName.Text; } catch (Exception ex) { MessageBox.Show("Validation failed"); return; } if (btnText.Equals("Save")) { // ptlist.TemplateNo = DocumentNumberDB.getNewNumber(docID, 1); ptlist.TemplateDate = UpdateTable.getSQLDateTime(); } else { ptlist.TemplateNo = Convert.ToInt32(txtTemplateNo.Text); ptlist.TemplateDate = prevsptheader.TemplateDate; } if (!PTTempDB.validateProductTestTemp(ptlist)) { MessageBox.Show("Validation Failed"); return; } if (btnText.Equals("Save")) { List <producttesttemplatedetail> PTTempDetails = getProdTempDetails(ptlist); if (PTTempDB.InsertPTHeaderAndDetail(ptlist, PTTempDetails)) { MessageBox.Show("Product Test Template Details Added"); closeAllPanels(); listOption = 1; ListFilteredProdTestTempList(listOption); } else { MessageBox.Show("Failed to Insert Product Test Template Details"); status = false; } } else if (btnText.Equals("Update")) { List <producttesttemplatedetail> PTTempDetails = getProdTempDetails(ptlist); if (PTTempDB.updatePTHeaderAndDetail(ptlist, PTTempDetails)) { MessageBox.Show("Product Test Template updated"); closeAllPanels(); listOption = 1; ListFilteredProdTestTempList(listOption); } else { status = false; MessageBox.Show("Failed to update Product Test Template Details"); } } else { MessageBox.Show("Validation failed"); status = false; } } catch (Exception ex) { MessageBox.Show(" Validation failed"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }
private void btnSave_Click_1(object sender, EventArgs e) { Boolean status = true; try { SMRNDB smrnhDB = new SMRNDB(); smrn smrnh = new smrn(); try { ////////smrnh.CourierID = cmbCourierID.SelectedItem.ToString().Trim().Substring(0,cmbCourierID.SelectedItem.ToString().Trim().IndexOf('-')); smrnh.CourierID = ((Structures.ComboBoxItem)cmbCourierID.SelectedItem).HiddenValue; //////////smrnh.CustomerID = cmbCustomer.SelectedItem.ToString().Trim().Substring(0, cmbCustomer.SelectedItem.ToString().Trim().IndexOf('-')); smrnh.CustomerID = ((Structures.ComboBoxItem)cmbCustomer.SelectedItem).HiddenValue; } catch (Exception) { smrnh.CustomerID = ""; smrnh.CustomerName = ""; } smrnh.DocumentID = docID; smrnh.SMRNDate = dtSMRNDate.Value; smrnh.CustomerDocumentDate = dtCustomerDocDate.Value; smrnh.Remarks = txtRemarks.Text; smrnh.NoOfPackets = Convert.ToInt32(txtNoOfPacket.Text); smrnh.CustomerDocumentNo = txtCuxtomerDocNo.Text; string btnText = btnSave.Text; if (btnText.Equals("Update")) { smrnh.ForwarderList = prevsh.ForwarderList; smrnh.SMRNNo = Convert.ToInt32(txtSMRNNo.Text); if (smrnhDB.validateSMRN(smrnh)) { if (smrnhDB.updateSMRN(smrnh, prevsh)) { MessageBox.Show("SMRN updated"); closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); } else { status = false; MessageBox.Show("Failed to update SMRN"); } } else { status = false; MessageBox.Show("Smrn DEtail Entered Wrong"); } } else if (btnText.Equals("Save")) { smrnh.DocumentStatus = 1;//created smrnh.SMRNDate = UpdateTable.getSQLDateTime(); smrnh.SMRNNo = DocumentNumberDB.getNewNumber(docID, 1); if (smrnhDB.validateSMRN(smrnh)) { if (smrnhDB.insertSMRN(smrnh)) { MessageBox.Show("SMRN Added"); closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); } else { MessageBox.Show("Failed to Insert SMRN"); status = false; } } else { status = false; MessageBox.Show("Smrn DEtail Entered Wrong"); } } else { status = false; MessageBox.Show("SMRN Data Operation failed"); } } catch (Exception ex) { MessageBox.Show("Failed Adding / Editing SMRN"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }
public bool InsertUpdateTable(UpdateTable updateTable) { db.UpdateTables.Add(updateTable); db.SaveChanges(); return(true); }