private void btn_sua_Click(object sender, EventArgs e) { category ctgr = new category(); try { if (CheckValidate() == true) { bool confirm = Util.Show_Message_YesNo(Message.msg_notification, "Chắc chắn sửa ?"); if (confirm) { ctgr.Name = txt_name_category.Text.Trim(); ctgr.Note = txt_Note.Text.Trim(); ctgr.UpdatedAt = DateTime.Now; ctgr.id = _ID_CATEGORY; bool check = DAL_QLCategory.Add_and_Edit_Category(ctgr, Variable.action_status.is_update, _user); if (check == true) { Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_edit_data); ((Form)this.TopLevelControl).Close(); } else { Util.Show_Message_Error(Message.msg_error, Message.msg_error_edit_data); } } } } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void Load_Data() { try { grcLaiSuat.DataSource = Util.ConvertToDataTable(DAL_QLLaiSuat.Get_List_InterestRate()); } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void Load_Data() { try { grcUser.DataSource = Util.ConvertToDataTable(Dal_User.Get_Data_User(_user)); } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void Load_Data() { try { grcCategory.DataSource = Util.ConvertToDataTable(DAL_QLCategory.Get_List_Category()); } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void grvKhachHang_DoubleClick(object sender, EventArgs e) { try { DXMouseEventArgs ea = e as DXMouseEventArgs; GridView view = sender as GridView; GridHitInfo info = view.CalcHitInfo(ea.Location); if (info.InRow || info.InRowCell) { DataRow row = grvKhachHang.GetDataRow(info.RowHandle); int idCustomer = int.Parse(row["id"].ToString().Trim()); Detail_Infor Detail_Infor = new Detail_Infor(); Detail_Infor.Str_Flag = Variable.detail_infor.Customer; Detail_Infor.Data = row; Detail_Infor._user = _user; //Detail_Infor.ShowDialog(); DialogResult dialog_result = Detail_Infor.ShowDialog(); if (dialog_result == DialogResult.Cancel) { Load_Data(); } } } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, "Có lỗi xảy ra !!!"); } }
private void btn_sua_Click(object sender, EventArgs e) { user ctgr = new user(); try { if (CheckValidate() == true) { if (Util.Show_Message_YesNo(Message.msg_notification, "Chắc chắn sửa")) { { //ctgr.UserName = txt_name_category.Text.Trim(); if (txt_password_user.Text.ToString().Trim() != "") { ctgr.PassWord = txt_password_user.Text.Trim(); } ctgr.FullName = txt_fullname.Text.Trim(); ctgr.PhoneNumber = txt_phone_user.Text.Trim(); ctgr.Address = txt_address_user.Text.Trim(); ctgr.Note = txt_Note.Text.Trim(); ctgr.BirthDay = DateTime.Parse(birthDay_user.Text.Trim()); ctgr.Sex = (bool)radio_sex_user.EditValue; ctgr.Type = (string)radio_type_user.EditValue; ctgr.IdCard = txt_idCard_user.Text.Trim(); ctgr.UpdatedAt = DateTime.Now; ctgr.id = _ID_USER; bool check = DAL_QLUser.Add_and_Edit_User(ctgr, Variable.action_status.is_update); if (check == true) { Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_edit_data); ((Form)this.TopLevelControl).Close(); } else { Util.Show_Message_Error(Message.msg_error, Message.msg_error_edit_data); } } } } } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void btn_update_Click(object sender, EventArgs e) { try { if (CheckValidate()) { if (Util.Show_Message_YesNo(Message.msg_notification, "Chắc chắn sửa ?")) { DataTable datasource = (DataTable)grcFriend.DataSource; List <Model.Friend> list_friend = datasource.AsEnumerable() .Select(m => new Model.Friend() { PhoneNumber = m.Field <string>("PhoneNumber"), FullName = m.Field <string>("FullName"), Relationship = m.Field <string>("Relationship"), Note = m.Field <string>("Note"), Id = m.Field <int>("Id") }).ToList(); int count = 0; foreach (var friend in list_friend) { friend friends = new friend(); friends.FullName = friend.FullName; friends.PhoneNumber = friend.PhoneNumber; friends.Relationship = friend.Relationship; friends.Note = friend.Note; friends.UpdatedBy = _user.id; friends.id = friend.Id; bool check = DAL_QLFriend.Add_and_Edit_Friend(friends, Variable.action_status.is_update); if (check) { count++; } else { Util.Show_Message_Error(Message.msg_error, Message.msg_error_edit_data); ((Form)this.TopLevelControl).Close(); break; } if (count == list_friend.Count) { Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_edit_data); ((Form)this.TopLevelControl).Close(); } } } } } catch (Exception) { Util.Show_Message_Notification(Message.msg_notification, "Có lỗi xảy ra"); } }
private void Load_Data() { try { grcHistoryPaid.DataSource = Util.ConvertToDataTable(DAL_Lichsutratien.Get_List_History_Paid()); } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void Load_Data() { try { grcKhachHang.DataSource = Util.ConvertToDataTable(Dal_Customer.Get_List_Customer()); } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void btn_sua_Click(object sender, EventArgs e) { try { customer Customer = new customer(); if (CheckValidate()) { if (Util.Show_Message_YesNo(Message.msg_notification, "Chắc chắn sửa ?")) { { Customer.Address = txt_edit_address.Text.ToString().Trim(); Customer.BirthDay = DateTime.Parse(birthDay_customer.Text.ToString().Trim()); Customer.FullName = txt_edit_fullname.Text.ToString().Trim(); Customer.IdCard = txt_edit_idcard.Text.ToString().Trim(); Customer.PhoneNumber = txt_edit_phone.Text.ToString().Trim(); Customer.Sex = (bool)radio_edit_sex.EditValue; Customer.FamilyPhoneNumber = txt_edit_familyphone.Text.ToString().Trim(); Customer.CategoryId = int.Parse(cbb_category.EditValue.ToString()); Customer.Money = Convert.ToInt32(txt_money.Text.ToString().Trim().Replace(",", "")); Customer.Note = txt_edit_note.Text.ToString().Trim(); Customer.id = _ID_CUSTOMER; Customer.cycle = Convert.ToInt32(txt_cycle.Value); bool check = DAL_QLCustomer.Add_and_Edit_Customer(Customer, new List <Model.Friend>(), Variable.action_status.is_update, _user); if (check == true) { Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_edit_data); ((Form)this.TopLevelControl).Close(); } else { Util.Show_Message_Error(Message.msg_error, Message.msg_error_edit_data); } } } } } catch (Exception ex) { Util.Show_Message_Error(Message.msg_error, ex.Message.ToString()); } }
private void btn_add_Click(object sender, EventArgs e) { try { if (CheckValidate()) { customer customer = new customer(); customer.Address = txt_address.Text.ToString().Trim(); customer.PhoneNumber = txt_phone.Text.ToString().Trim(); customer.BirthDay = (DateTime)birthDay_customer.DateTime; customer.CategoryId = int.Parse(cbb_category.EditValue.ToString()); customer.FullName = txt_fullname.Text.ToString().Trim(); customer.IdCard = txt_idcard.Text.ToString().Trim(); customer.Money = Convert.ToInt32(txt_money.Text.ToString().Trim().Replace(",", "")); customer.FamilyPhoneNumber = txt_familyphone.Text.ToString().Trim(); customer.Sex = (bool)radio_sex.EditValue; customer.Status = true; customer.InterestId = 1; customer.CreatedBy = _user.id; customer.UpdatedBy = _user.id; customer.CreatedAt = (DateTime)date_paid.DateTime; customer.UpdatedAt = DateTime.Now; customer.cycle = Convert.ToInt32(txt_cycle.Text); DataTable datasource = (DataTable)grcAddFriend.DataSource; List <Model.Friend> list_friend = datasource.AsEnumerable() .Select(m => new Model.Friend() { PhoneNumber = m.Field <string>("PhoneNumber"), FullName = m.Field <string>("FullName"), Relationship = m.Field <string>("Relationship"), Note = m.Field <string>("Note") }).ToList(); bool check = DAL_QLCustomer.Add_and_Edit_Customer(customer, list_friend, Variable.action_status.is_add, _user); if (check == true) { Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_add_data); ((Form)this.TopLevelControl).Close(); } else { Util.Show_Message_Error(Message.msg_error, Message.msg_error_add_data); } } } catch (Exception ex) { throw ex; } }