private void btn_save_Click(object sender, EventArgs e) { try { if (!ValidateInput()) { return; } RfCardMaster type = new RfCardMaster(); type.Id = int.Parse(lbl_id.Text.Trim()); type.CardNo = txt_name.Text; type.CardStatus = commonFunctions.ToInt(cmb_fueltypes.SelectedIndex.ToString()); type.IssueDate = DateTime.Now; type.IssuedBy = commonFunctions.LoginuserID; type.GroupOfCompanyID = 1; type.ModifiedUser = commonFunctions.LoginuserID; type.ModifiedDate = DateTime.Now; type.CreatedUser = commonFunctions.LoginuserID; type.CreatedDate = DateTime.Now; type.DataTransfer = 1; if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Save(type); GetData(); } } catch (Exception ex) { MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void NavigateDataGrid(string v) { try { RfCardMaster type = repo.Get(int.Parse(v.Trim())); if (type != null) { lbl_id.Text = type.Id.ToString(); txt_name.Text = type.CardNo; cmb_fueltypes.SelectedIndex = type.CardStatus; } } catch (Exception ex) { } }