Esempio n. 1
0
        public void DoanhThuTong(BunifuiOSSwitch switchdoanhthu, BunifuDatepicker DPDoanhThu, Label lbdtdatphong, Label lbsophong, Label lbdichvu)
        {
            string day, month, year;

            if (switchdoanhthu.Value == true)
            {
                ch.ChuanHoaDate(DPDoanhThu.Value.ToString(), out day, out month, out year);
                tt.ThanhTien = conn.LayBien("EXEC PROC_SELECT_TONGTIEN '" + year + month + day + "'", 0);
                sophong      = conn.LayBien("EXEC PROC_SELECT_SOPHONG '" + year + month + day + "'", 0);
                if (tt.ThanhTien == "")
                {
                    tt.ThanhTien = "0";
                }
                lbdtdatphong.Text = (Int32.Parse(tt.ThanhTien) * 1000).ToString();
                lbsophong.Text    = sophong;
            }
            else
            {
                tt.ThanhTien = conn.LayBien("EXEC PROC_SELECT_TONGTIEN1", 0);
                sophong      = conn.LayBien("EXEC PROC_SELECT_SOPHONG1", 0);
                if (tt.ThanhTien == "")
                {
                    tt.ThanhTien = "0";
                }
                lbdtdatphong.Text = (Int32.Parse(tt.ThanhTien) * 1000).ToString();
                lbsophong.Text    = sophong;
            }
        }
Esempio n. 2
0
 public void setDate(string sursa, string beneficiar, BunifuDatepicker dataComanda, string oraLivrare, string adresa, string telefon, string telefonRezerva, string servicii, float pretTotal, float avans, float rest, string bcf)
 {
     this.sursa          = sursa;
     this.beneficiar     = beneficiar;
     this.dataComanda    = new DateTime(dataComanda.Value.Year, dataComanda.Value.Month, dataComanda.Value.Day);
     this.oraLivrare     = oraLivrare;
     this.adresa         = adresa;
     this.telefon        = telefon;
     this.telefonRezerva = telefonRezerva;
     this.servicii       = servicii;
     this.pretTotal      = pretTotal;
     this.avans          = avans;
     this.rest           = pretTotal - avans;
     this.bcf            = bcf;
 }
Esempio n. 3
0
 /// <summary>
 /// auto fill principal and vice data
 /// </summary>
 /// <param name="tabPage"></param>
 /// <param name="data"></param>
 void AutoFillPrincipalOrViceData(ref MetroTabPage tabPage, PrincipalAndVice data)
 {
     foreach (var i in tabPage.Controls)
     {
         if (i is TextBox)
         {
         }
         else if (i is ComboBox)
         {
             ComboBox temp = (ComboBox)i;
             if (temp.Name == "comboBoxPrincipalName" || temp.Name == "comboBoxVicePrincipalName")
             {
                 temp.SelectedItem = Connection.Instance.GetAgentName(data.AgentID);
             }
             else if (temp.Name == "comboBoxPrincipalBranchName" || temp.Name == "comboBoxVicePrincipalBranchName")
             {
                 temp.SelectedItem = Connection.Instance.GetBranchNameFromID(data.BranchID);
             }
         }
         else if (i is MyTextBox)
         {
             MyTextBox temp = (MyTextBox)i;
             temp.Text = "";
         }
         else if (i is Label)
         {
             Label temp = (Label)i;
             if (temp.Name == "labelPrincipalDateJoined" || temp.Name == "labelVicePrincipalDateJoined")
             {
                 temp.Text = data.DateSelected.ToString("dddd, dd - MMM - yyyy");
             }
         }
         else if (i is BunifuDatepicker)
         {
             BunifuDatepicker temp = (BunifuDatepicker)i;
             if (temp.Name == "dateTimePickerPrincipalDateJoinend" || temp.Name == "dateTimePickerVicePrincipalDateJoined")
             {
                 temp.Value = data.DateSelected;
             }
         }
     }
 }
Esempio n. 4
0
 public void setDataLivrare(BunifuDatepicker dtl)
 {
     this.dataLivrare = new DateTime(dtl.Value.Year, dtl.Value.Month, dtl.Value.Day);
     ziuaLivrare      = convertireData();
 }
        public void DatPhong(TextBoxX tbhoten, BunifuDropdown ddGioiTinh, TextBoxX tbsocmt, TextBoxX tbphone, BunifuDatepicker DPNgayDat, BunifuDatepicker DPNgayTra, Label label2, Label label8, out int transfer)
        {
            transfer = 0;
            ChuanHoa ch = new ChuanHoa();

            HotelObject.KhachHangHo kh = new HotelObject.KhachHangHo();
            HotelObject.ThuePhongHo tp = new HotelObject.ThuePhongHo();
            HotelObject.PhongHo     p = new HotelObject.PhongHo();
            string day, month, year;
            string day1, month1, year1;
            string day2, month2, year2;

            ch.ChuanHoaDate(DPNgayTra.Value.ToString(), out day1, out month1, out year1);
            ch.ChuanHoaDate(DPNgayDat.Value.ToString(), out day, out month, out year);
            ch.ChuanHoaDate(DateTime.Now.ToString(), out day2, out month2, out year2);
            Connection cn = new Connection();

            if (ch.CheckTB(tbhoten.Text, tbsocmt.Text, tbphone.Text) == false)
            {
                Notification nf = new Notification("LỖI", "Thông tin phải được nhập đầy đủ.", "Mời bạn nhập lại.");
                nf.Show();
            }
            else if (ch.Check_Text_Name(tbhoten) == false)
            {
                Notification nf = new Notification("LỖI", "Tên không chứa chữ số.", "Mời bạn nhập lại.");
                nf.Show();
            }
            else if (ch.CheckDate(Int32.Parse(day2), Int32.Parse(month2), Int32.Parse(year2), Int32.Parse(day), Int32.Parse(month), Int32.Parse(year)) == false)
            {
                Notification nf = new Notification("LỖI", "Ngày đặt phòng không hợp lệ.", "Mời bạn nhập lại.");
                nf.Show();
            }
            else if (ch.CheckDate(Int32.Parse(day), Int32.Parse(month), Int32.Parse(year), Int32.Parse(day1), Int32.Parse(month1), Int32.Parse(year1)) == false)
            {
                Notification nf = new Notification("LỖI", "Ngày đặt phòng và ngày trả phòng không hợp lệ.", "Mời bạn nhập lại.");
                nf.Show();
            }

            else if (ch.Check_SoCMT(tbsocmt) == false)
            {
                Notification nf = new Notification("LỖI", "Số CMT không hợp lệ.", "Mời bạn nhập lại.");
                nf.Show();
            }
            else if (ch.Check_Phone(tbphone) == false)
            {
                Notification nf = new Notification("LỖI", "Số điện thoại không hợp lệ.", "Mời bạn nhập lại.");
                nf.Show();
            }
            else
            {
                kh.TenKhachHang = ch.CH_Name(tbhoten);
                kh.SoCMT        = ch.CH_Space(tbsocmt);
                string temp = null, temp2 = null;
                kh.MaKhachHang = cn.LayBien("select makhachhang from khachhang order by makhachhang asc", 0);
                tp.MaThue      = cn.LayBien("select mathue from thuephong order by mathue asc", 0);
                for (int i = 2; i < tp.MaThue.Length; i++)
                {
                    temp2 = temp2 + tp.MaThue[i];
                }
                tp.MaThue = "TP" + (Int32.Parse(temp2) + 1).ToString();
                p.MaPhong = cn.LayBien("select maphong from phong where tenphong='" + label2.Text + "'", 0);
                for (int i = 2; i < kh.MaKhachHang.Length; i++)
                {
                    temp = temp + kh.MaKhachHang[i];
                }

                kh.MaKhachHang = "KH" + (Int32.Parse(temp) + 1).ToString();

                cn.InsertDeleteUpdate("INSERT INTO KHACHHANG VALUES('" + kh.MaKhachHang + "',N'" + kh.TenKhachHang + "',N'" + ddGioiTinh.selectedValue + "','" + kh.SoCMT + "','" + tbphone.Text + "')");
                cn.InsertDeleteUpdate("INSERT INTO THUEPHONG VALUES('" + tp.MaThue + "','" + kh.MaKhachHang + "','" + p.MaPhong + "','" + year + month + day + "','" + year1 + month1 + day1 + "',1)");
                Notification nf = new Notification("ĐẶT PHÒNG", "Đặt phòng thành công.", "");
                nf.Show();
                transfer = 1;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// auto fill the agents data
        /// </summary>
        /// <param name="tabPage"></param>
        /// <param name="data"></param>
        void AutoFillAgentData(ref MetroTabPage tabPage, Agent data)
        {
            foreach (var i in tabPage.Controls)
            {
                if (i is BunifuMaterialTextbox)
                {
                    BunifuMaterialTextbox temp = (BunifuMaterialTextbox)i;
                    if (temp.Name == "textBoxUpdateAgentEmail")
                    {
                        temp.Text = data.Email;
                    }

                    if (temp.Name == "labelDisableAgentEmail")
                    {
                        temp.Text = data.Email;
                    }
                    else if (temp.Name == "labelDisableAgentPhoneNumber")
                    {
                        temp.Text = data.PhoneNumber;
                    }
                    else if (temp.Name == "labelDisableAgentDateJoined")
                    {
                        temp.Text = data.DateJoined.ToString();
                    }
                    else if (temp.Name == "labelDisableAgentBranchName")
                    {
                        temp.Text = Connection.Instance.GetBranchNameFromAgentID(data.ID);
                    }
                    else if (temp.Name == "labelDisableAgentUplineName")
                    {
                        temp.Text = Connection.Instance.GetAgentName(data.UplineID);
                    }
                    else if (temp.Name == "labelUpdateAgentDateJoined")
                    {
                        temp.Text = data.DateJoined.ToString("dddd, dd - MMM - yyyy");
                    }
                }
                else if (i is ComboBox)
                {
                    ComboBox temp = (ComboBox)i;
                    if (temp.Name == "comboBoxUpdateAgentID" || temp.Name == "comboBoxDisableAgentID")
                    {
                        temp.SelectedItem = data.ID;
                    }
                    else if (temp.Name == "comboBoxUpdateAgentName" || temp.Name == "comboBoxDisableAgentName")
                    {
                        temp.SelectedItem = data.Name;
                    }
                    else if (temp.Name == "comboBoxUpdateAgentBranchName")
                    {
                        temp.SelectedItem = Connection.Instance.GetBranchNameFromID(data.BranchID);
                    }
                    else if (temp.Name == "comboBoxUpdateAgentUplineName")
                    {
                        temp.SelectedItem = Connection.Instance.GetAgentName(data.UplineID);
                    }
                }
                else if (i is MyTextBox)
                {
                    MyTextBox temp = (MyTextBox)i;
                    temp.Text = "";
                }
                else if (i is Label)
                {
                    Label temp = (Label)i;
                    if (temp.Name == "labelDisableAgentEmail")
                    {
                        temp.Text = data.Email;
                    }
                    else if (temp.Name == "labelDisableAgentPhoneNumber")
                    {
                        temp.Text = data.PhoneNumber;
                    }
                    else if (temp.Name == "labelDisableAgentDateJoined")
                    {
                        temp.Text = data.DateJoined.ToString();
                    }
                    else if (temp.Name == "labelDisableAgentBranchName")
                    {
                        temp.Text = Connection.Instance.GetBranchNameFromAgentID(data.ID);
                    }
                    else if (temp.Name == "labelDisableAgentUplineName")
                    {
                        temp.Text = Connection.Instance.GetAgentName(data.UplineID);
                    }
                    else if (temp.Name == "labelUpdateAgentDateJoined")
                    {
                        temp.Text = data.DateJoined.ToString("dddd, dd - MMM - yyyy");
                    }
                }
                else if (i is BunifuDatepicker)
                {
                    BunifuDatepicker temp = (BunifuDatepicker)i;
                    if (temp.Name == "dateTimePickerUpdateAgent")
                    {
                        temp.Value = data.DateJoined;
                    }
                }
                else if (i is TextBox)
                {
                    TextBox temp = (TextBox)i;
                    if (temp.Name == "textBoxNumericUpdateAgentPhoneNumber")
                    {
                        temp.Text = data.PhoneNumber;
                    }
                }
            }
        }
 public static void LoadProductInformation(MetroComboBox cmbProductName, GunaTextBox txtItemNumber, GunaTextBox txtStocks, BunifuDatepicker dtpDateCreation, MetroComboBox cmbCategory)
 {
     try
     {
         using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["POS_SYSTEM"].ConnectionString))
         {
             connection.Open();
             string query = "SELECT product_item_code, product_stocks, product_category FROM tbl_products WHERE product_id = @product_id;";
             using (var command = new MySqlCommand(query, connection))
             {
                 command.Parameters.Add("product_id", MySqlDbType.Int32).Value = cmbProductName.SelectedValue;
                 MySqlDataReader reader = command.ExecuteReader();
                 if (reader.HasRows)
                 {
                     while (reader.Read())
                     {
                         txtItemNumber.Text    = reader["product_item_code"].ToString();
                         txtStocks.Text        = reader["product_stocks"].ToString();
                         dtpDateCreation.Value = DateTime.Today;
                         cmbCategory.Text      = reader["product_category"].ToString();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public void ThemNhanVien(TextBoxX tbhoten, BunifuDropdown ddGioiTinh, TextBoxX tbpass, TextBoxX tbphone, BunifuDatepicker DPNgaySinh, BunifuDropdown ddchucvu, string btavtar, out int transfer)
        {
            transfer = 0;
            HotelObject.NhanVienHo nv = new HotelObject.NhanVienHo();
            string   temp             = null;
            ChuanHoa ch = new ChuanHoa();

            nv.NgaySinh = DPNgaySinh.Value.ToString();
            ch.ChuanHoaDate(nv.NgaySinh, out day, out month, out year);
            nv.NgaySinh   = year + month + day;
            nv.MaNhanVien = conn.LayBien("EXEC PROC_SELECT_MANHANVIEN", 0);
            if (nv.MaNhanVien == "" || nv.MaNhanVien == null || nv.MaNhanVien == "1" || nv.MaNhanVien == "ADMIN")
            {
                nv.MaNhanVien = "NV1234";
            }

            for (int i = 2; i < nv.MaNhanVien.Length; i++)
            {
                temp = temp + nv.MaNhanVien[i];
            }
            nv.MaNhanVien = "NV" + (Int32.Parse(temp) + 1).ToString();
            nv.HoTen      = ch.CH_Name(tbhoten);
            if (ch.Check_Phone(tbphone) == false)
            {
                Notification nf = new Notification("LỖI", "Số điện thoại không hợp lệ", "Mời bạn nhập lại.");
                nf.Show();
                transfer = 0;
            }
            else if (ch.Check_Text_Name(tbhoten) == false)
            {
                Notification nf = new Notification("LỖI", "Tên nhập chứa chữ số", "Mời bạn nhập lại.");
                nf.Show();
                transfer = 0;
            }
            else
            {
                conn.InsertDeleteUpdate("EXEC PROC_INSERT_NHANVIEN '" + nv.MaNhanVien + "','" + tbpass.Text + "',N'" + tbhoten.Text + "',N'" + ddchucvu.selectedValue + "',N'" + ddGioiTinh.selectedValue + "',N'" + btavtar + "','" + year + month + day + "','" + tbphone.Text + "'");
                Notification nf = new Notification("THÊM NHÂN VIÊN", "Thêm nhân viên thành công.", "Mã nhân viên :" + nv.MaNhanVien);
                nf.Show();
                transfer = 1;
            }
        }