private void btnSave_Click(object sender, EventArgs e) { if (tbxName.Text.Equals(string.Empty)) { MessageBox.Show("ST Name can not be blank!"); return; } STFormMasterModel objModel = new STFormMasterModel(); objModel.Name = tbxName.Text.Trim(); objModel.PrintName = tbxPrintname.Text.Trim(); objModel.STRegType = cbxStregtype.SelectedItem.ToString(); objModel.CreatedBy = "Admin"; bool isSuccess = objStform.SaveSTF(objModel); if (isSuccess) { MessageBox.Show("Saved Successfully!"); ClearControls(); tbxName.Focus(); } }
public List <STFormMasterModel> GetAllSTF() { List <STFormMasterModel> lstSTF = new List <STFormMasterModel>(); STFormMasterModel objModel; string Query = "SELECT * FROM STFormMaster"; System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject()); while (dr.Read()) { objModel = new STFormMasterModel(); objModel.STF_Id = Convert.ToInt32(dr["STF_Id"]); objModel.Name = dr["Name"].ToString(); objModel.PrintName = dr["PrintName"].ToString(); objModel.STRegType = dr["STRegType"].ToString(); lstSTF.Add(objModel); } return(lstSTF); }
private void btnUpdate_Click(object sender, EventArgs e) { STFormMasterModel objModel = new STFormMasterModel(); objModel.Name = tbxName.Text.Trim(); objModel.PrintName = tbxPrintname.Text.Trim(); objModel.STRegType = cbxStregtype.SelectedItem.ToString(); objModel.STF_Id = ST_Id; bool isSuccess = objStform.UpdateSTF(objModel); if (isSuccess) { MessageBox.Show("Update Successfully!"); ST_Id = 0; ClearControls(); Administration.List.StformList frmList = new Administration.List.StformList(); frmList.StartPosition = FormStartPosition.CenterScreen; frmList.ShowDialog(); FillSTFormInfo(); } }