private void btnUpdate_Click(object sender, EventArgs e) { if (tbxNarration.Text.Equals(string.Empty)) { MessageBox.Show("Std.Narration can not be blank!"); return; } StdNarrationMasterModel objModel = new StdNarrationMasterModel(); objModel.Narration = tbxNarration.Text.Trim(); objModel.Vouchertype = cbxVouchertype.SelectedItem.ToString(); objModel.Narration2 = tbxNarration2.Text.Trim() == string.Empty ? string.Empty : tbxNarration2.Text.Trim(); objModel.SN_Id = StdId; bool isSuccess = objstdNrr.UpdateStdNarration(objModel); if (isSuccess) { MessageBox.Show("Update Successfully!"); ClearControls(); StdId = 0; Administration.List.StdnarrationList frmList = new Administration.List.StdnarrationList(); frmList.StartPosition = FormStartPosition.CenterScreen; frmList.ShowDialog(); cbxVouchertype.Focus(); FillStdNarrationInfo(); } }
private void btnSave_Click(object sender, EventArgs e) { if (tbxNarration.Text.Equals(string.Empty)) { MessageBox.Show("Narration can not be blank!"); return; } //if (accObj.IsGroupExists(tbxGroupName.Text.Trim())) //{ // MessageBox.Show("Group Name already Exists!", "SunSpeed", MessageBoxButtons.RetryCancel); // cbxUnderGrp.Focus(); // return; //} StdNarrationMasterModel objModel = new StdNarrationMasterModel(); objModel.Narration = tbxNarration.Text.Trim(); objModel.Vouchertype = cbxVouchertype.SelectedItem.ToString(); bool isSuccess = objstdNrr.SaveStdNarration(objModel); if (isSuccess) { MessageBox.Show("Saved Successfully!"); } //List<StdNarrationMasterModel> lstNarr = accObj.GetAllStdNarration(); //dgvList.DataSource = lstNarr; //Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!"); //d.ShowDialog(); }
//Get All Stdnarrations By ID public StdNarrationMasterModel GetAllStdNarrationById(int id) { StdNarrationMasterModel objNarr = new StdNarrationMasterModel(); string Query = "SELECT * FROM StdNarrationMaster WHERE SN_ID=" + id + ""; System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject()); while (dr.Read()) { objNarr.SN_Id = Convert.ToInt32(dr["SN_ID"]); objNarr.Vouchertype = dr["Vouchertype"].ToString(); objNarr.Narration = dr["Narration"].ToString(); objNarr.Narration2 = dr["Narration2"].ToString(); } return(objNarr); }
private void FillStdNarrationInfo() { if (StdId == 0) { cbxVouchertype.Focus(); ClearControls(); lblSave.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; return; } StdNarrationMasterModel objNarration = objstdNrr.GetAllStdNarrationById(StdId); cbxVouchertype.SelectedItem = objNarration.Vouchertype; tbxNarration.Text = objNarration.Narration; tbxNarration2.Text = objNarration.Narration2; lblSave.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; cbxVouchertype.Focus(); }
private void btnSave_Click(object sender, EventArgs e) { if (tbxNarration.Text.Equals(string.Empty)) { MessageBox.Show("Std.Narration can not be blank!"); tbxNarration.Focus(); return; } StdNarrationMasterModel objModel = new StdNarrationMasterModel(); objModel.Vouchertype = cbxVouchertype.SelectedItem.ToString(); objModel.Narration = tbxNarration.Text.Trim(); objModel.Narration2 = tbxNarration2.Text.Trim() == string.Empty ? string.Empty : tbxNarration2.Text.Trim(); bool isSuccess = objstdNrr.SaveStdNarration(objModel); if (isSuccess) { MessageBox.Show("Saved Successfully!"); ClearControls(); } }
//List public List <eSunSpeedDomain.StdNarrationMasterModel> GetAllStdNarration() { List <eSunSpeedDomain.StdNarrationMasterModel> lstNarration = new List <StdNarrationMasterModel>(); eSunSpeedDomain.StdNarrationMasterModel objNarr; string Query = "SELECT * FROM StdNarrationMaster"; System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject()); while (dr.Read()) { objNarr = new StdNarrationMasterModel(); objNarr.SN_Id = Convert.ToInt32(dr["SN_ID"]); objNarr.Narration = dr["Narration"].ToString(); objNarr.Vouchertype = dr["Vouchertype"].ToString(); objNarr.CreatedBy = dr["CreatedBy"].ToString(); lstNarration.Add(objNarr); } return(lstNarration); }