Esempio n. 1
0
        public bool CheckValidate()
        {
            try
            {
                if (txt_percent.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập phần trăm lãi xuất");
                    txt_percent.Focus();
                    return(false);
                }
                else
                {
                    double percents;
                    bool   isDouble = Double.TryParse(txt_percent.Text.ToString().Trim(), out percents);
                    if (!isDouble)
                    {
                        Util.Show_Message_Notification(Message.msg_notification, "Lãi suất nhập không đúng định dạng");
                        txt_percent.Focus();
                        return(false);
                    }
                }

                if (date_start.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập ngày bắt đầu");
                    date_start.Focus();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(true);
        }
Esempio n. 2
0
        private void btn_them_Click(object sender, EventArgs e)
        {
            category ctgr = new category();

            try
            {
                if (CheckValidate() == true)
                {
                    ctgr.Name      = txt_name_category.Text.Trim();
                    ctgr.Note      = txt_ghi_chu.Text.Trim();
                    ctgr.CreatedAt = DateTime.Now;
                    ctgr.UpdatedAt = DateTime.Now;
                    ctgr.Status    = true;
                    ctgr.CreatedBy = 1;
                    ctgr.UpdatedBy = 1;

                    bool check = DAL_QLCategory.Add_and_Edit_Category(ctgr, Variable.action_status.is_add);
                    if (check == true)
                    {
                        Util.Show_Message_Notification(Message.msg_notification, Message.msg_success_add_data);
                        Load_Data();
                    }
                    else
                    {
                        Util.Show_Message_Error(Message.msg_error, Message.msg_error_add_data);
                    }
                }
            }
            catch (Exception ex)
            {
                Util.Show_Message_Error(Message.msg_error, ex.Message.ToString());
            }
        }
 public bool CheckValidate()
 {
     if (txt_password.Text == "")
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập mật khẩu cũ");
         return(false);
     }
     else if (txt_password.Text != _user.PassWord)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Mật khẩu cũ không chính xác");
         return(false);
     }
     if (txt_new_password.Text == "")
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập mật khẩu mới");
         return(false);
     }
     if (txt_confirm_password.Text == "")
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng xác nhận mật khẩu mới");
         return(false);
     }
     else if (txt_new_password.Text != txt_confirm_password.Text)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Xác nhận mật khẩu không chính xác !!!");
         return(false);
     }
     return(true);
 }
        private bool CheckValidate()
        {
            bool check = true;

            try
            {
                if (txt_name_category.Text == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập tên danh mục");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(check);
        }
Esempio n. 5
0
 private void uc_Lichsuthanhtoan_Load(object sender, EventArgs e)
 {
     try
     {
         grcLichsu.DataSource = Util.ConvertToDataTable(DAL_LichSuTraTien.Get_List_History_Paid(idCustomer));
     }
     catch (Exception)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Không thể kết nối đến cơ sở dữ liệu !!!");
     }
 }
Esempio n. 6
0
        private bool CheckValidate()
        {
            bool check = true;

            try
            {
                if (txt_address_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập địa chỉ");
                    txt_address_user.Focus();
                    return(false);
                }
                if (txt_fullname.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên");
                    txt_fullname.Focus();
                    return(false);
                }
                if (txt_idCard_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số chứng minh thư");
                    txt_idCard_user.Focus();
                    return(false);
                }
                if (txt_phone_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại");
                    txt_phone_user.Focus();
                    return(false);
                }
                if (txt_username.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập username");
                    txt_username.Focus();
                    return(false);
                }
                if (birthDay_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn ngày sinh");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(check);
        }
Esempio n. 7
0
        public List <category> Get_List_Category(string table_name)
        {
            List <category> lst_category = new List <category>();

            try
            {
                lst_category = (from data in _db.categories
                                where data.Status == true
                                select data).ToList();
                return(lst_category);
            }
            catch (Exception ex)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Không thể kết nối đến cơ sở dữ liệu");
            }
            return(lst_category);
        }
Esempio n. 8
0
        public bool CheckValidate()
        {
            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")
            }).ToList();

            if (list_friend == null || list_friend.Count == 0)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập bạn bè");
                return(false);
            }
            for (int i = 0; i < list_friend.Count; i++)
            {
                if (list_friend[i].PhoneNumber == null || list_friend[i].PhoneNumber == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại cho bạn số " + (i + 1));
                    return(false);
                }
                if (list_friend[i].FullName == null || list_friend[i].FullName == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên cho bạn số " + (i + 1));
                    return(false);
                }
                if (list_friend[i].Relationship == null || list_friend[i].Relationship == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập mối quan hệ cho bạn số " + (i + 1));
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 9
0
 public bool CheckValidate()
 {
     if (txt_edit_fullname.Text.ToString().Trim() == "" || txt_edit_fullname.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên");
         return(false);
     }
     if (txt_edit_address.Text.ToString().Trim() == "" || txt_edit_address.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập địa chỉ");
         return(false);
     }
     if (txt_edit_idcard.Text.ToString().Trim() == "" || txt_edit_idcard.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số chứng minh thư");
         return(false);
     }
     if (txt_money.Text.ToString().Trim() == "" || txt_money.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số tiền vay");
         return(false);
     }
     else
     {
         int parsedValue;
         if (!int.TryParse(txt_money.Text.ToString().Trim().Replace(",", ""), out parsedValue))
         {
             Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập đúng định dạng số tiền");
             return(false);
         }
     }
     if (txt_edit_phone.Text.ToString().Trim() == "" || txt_edit_phone.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại khách hàng");
         return(false);
     }
     if (txt_edit_familyphone.Text.ToString().Trim() == "" || txt_edit_familyphone.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại gia đình");
         return(false);
     }
     if (birthDay_customer.Text.ToString().Trim() == "" || birthDay_customer.Text.ToString().Trim() == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập ngày sinh");
         return(false);
     }
     if (cbb_category.EditValue == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn đồ cần cầm");
         return(false);
     }
     if (txt_cycle.Value == 0 || txt_cycle.Value == null)
     {
         Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập chu kỳ");
         return(false);
     }
     return(true);
 }
Esempio n. 10
0
        private bool CheckValidate()
        {
            bool check = true;

            try
            {
                if (txt_add_fullname_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên");
                    txt_add_fullname_user.Focus();
                    return(false);
                }
                if (txt_add_username.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập tên tài khoản");
                    txt_add_username.Focus();
                    return(false);
                }
                if (txt_add_password.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập mật khẩu");
                    txt_add_password.Focus();
                    return(false);
                }
                if (txt_add_phone_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại");
                    txt_add_phone_user.Focus();
                    return(false);
                }
                if (txt_add_cmnd_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số chứng minh thư");
                    txt_add_cmnd_user.Focus();
                    return(false);
                }
                if (txt_add_address_user.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập địa chỉ");
                    txt_add_address_user.Focus();
                    return(false);
                }
                if (date_birthday.Text.ToString().Trim() == "")
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn ngày sinh");
                    return(false);
                }
                if (radio_sex_user.EditValue == null)
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn giới tính");
                    return(false);
                }
                if (radio_type_user.EditValue == null)
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn loại tài khoản");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(check);
        }
Esempio n. 11
0
        private bool CheckValidate()
        {
            if (txt_fullname.Text.ToString().Trim() == "" || txt_fullname.Text.ToString().Trim() == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên");
                txt_fullname.Focus();
                return(false);
            }
            if (txt_address.Text.ToString().Trim() == "" || txt_address.Text.ToString().Trim() == null)
            {
                txt_address.Focus();
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập địa chỉ");
                return(false);
            }
            if (txt_idcard.Text.ToString().Trim() == "" || txt_idcard.Text.ToString().Trim() == null)
            {
                txt_idcard.Focus();
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số chứng minh thư");
                return(false);
            }
            if (txt_money.Text.ToString().Trim() == "" || txt_money.Text.ToString().Trim() == null)
            {
                txt_money.Focus();
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số tiền vay");
                return(false);
            }
            else
            {
                int parsedValue;
                if (!int.TryParse(txt_money.Text.ToString().Trim().Replace(",", ""), out parsedValue))
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập đúng định dạng số tiền");
                    txt_money.Focus();
                    return(false);
                }
            }
            if (txt_phone.Text.ToString().Trim() == "" || txt_phone.Text.ToString().Trim() == null)
            {
                txt_phone.Focus();
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập");
                return(false);
            }
            if (txt_familyphone.Text.ToString().Trim() == "" || txt_familyphone.Text.ToString().Trim() == null)
            {
                txt_familyphone.Focus();
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại gia đình");
                return(false);
            }
            if (birthDay_customer.Text.ToString().Trim() == "" || birthDay_customer.Text.ToString().Trim() == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập ngày sinh");
                return(false);
            }
            if (radio_sex.EditValue == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn giới tính");
                return(false);
            }
            if (cbb_category.EditValue == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng chọn đồ cần cầm");
                return(false);
            }
            if (txt_cycle.Text.ToString().Trim() == "" || txt_cycle.Text.ToString().Trim() == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập chu kỳ");
                return(false);
            }
            else
            {
                int parsedValue;
                if (!int.TryParse(txt_cycle.Text.ToString().Trim().Replace(",", ""), out parsedValue))
                {
                    Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập đúng định dạng chu kỳ");
                    return(false);
                }
            }
            DataTable datasource = (DataTable)grcAddFriend.DataSource;

            if (datasource == null)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập danh sách bạn bè");
                return(false);
            }
            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();
            int count = list_friend.Count;

            if (count < 3)
            {
                Util.Show_Message_Notification(Message.msg_notification, "Số bạn bè phải >= 3");
                return(false);
            }
            else
            {
                for (int i = 0; i < list_friend.Count; i++)
                {
                    if (list_friend[i].PhoneNumber == null)
                    {
                        Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập số điện thoại cho bạn số " + (i + 1));
                        return(false);
                    }
                    if (list_friend[i].FullName == null)
                    {
                        Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập họ tên cho bạn số " + (i + 1));
                        return(false);
                    }
                    if (list_friend[i].Relationship == null)
                    {
                        Util.Show_Message_Notification(Message.msg_notification, "Vui lòng nhập mối quan hệ cho bạn số " + (i + 1));
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 12
0
        private void btn_thanh_toan_Click(object sender, EventArgs e)
        {
            bool check = false, checkTienLai = false, checkTienGoc = false;

            try
            {
                if (CheckValidate())
                {
                    bool confirmPaid = Util.Show_Message_YesNo(Message.msg_notification, "Chắc chắn thanh toán ?");
                    if (confirmPaid)
                    {
                        if (_isTienlai)
                        {
                            historyPaid paid = new historyPaid();
                            paid.Money      = Convert.ToInt32(txt_money_lai.Text.ToString().Trim().Replace(",", ""));
                            paid.TypePaid   = "1";
                            paid.CustomerId = idCustomer;
                            paid.CreatedAt  = DateTime.Now;
                            paid.UpdatedAt  = DateTime.Now;
                            paid.UpdatedBy  = _user.id;
                            paid.CreatedBy  = _user.id;
                            paid.Status     = true;
                            paid.PaidDate   = DateTime.Now;
                            checkTienLai    = DAL_LichSuTraTien.Add_Paid_Money(paid, Variable.action_status.is_add, _user);
                        }
                        if (_isTiengoc)
                        {
                            historyPaid paid = new historyPaid();
                            paid.Money      = Convert.ToInt32(txt_money.Text.ToString().Trim().Replace(",", ""));
                            paid.TypePaid   = "0";
                            paid.CustomerId = idCustomer;
                            paid.CreatedAt  = DateTime.Now;
                            paid.UpdatedAt  = DateTime.Now;
                            paid.UpdatedBy  = _user.id;
                            paid.CreatedBy  = _user.id;
                            paid.Status     = true;
                            paid.PaidDate   = DateTime.Now;
                            checkTienGoc    = DAL_LichSuTraTien.Add_Paid_Money(paid, Variable.action_status.is_add, _user);
                        }
                        if (_isTienlai && _isTiengoc)
                        {
                            if (checkTienGoc && checkTienLai)
                            {
                                check = true;
                            }
                        }
                        else if (_isTiengoc)
                        {
                            if (checkTienGoc)
                            {
                                check = true;
                            }
                        }
                        else if (_isTienlai)
                        {
                            if (checkTienLai)
                            {
                                check = true;
                            }
                        }
                        if (check)
                        {
                            Util.Show_Message_Notification(Message.msg_notification, "Thanh toán thành công !!!");
                            ((Form)this.TopLevelControl).Close();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }