Exemplo n.º 1
0
 static void LoadAllCode()
 {
     try
     {
         lock (c_Allcode.SyncRoot)
         {
             Allcode_Controller _AllCodeController = new Allcode_Controller();
             c_Allcode.Clear();
             List <AllCode_Info> _lst_al = _AllCodeController.AllCode_Get_All();
             if (_lst_al.Count > 0)
             {
                 foreach (AllCode_Info item in _lst_al)
                 {
                     if (c_Allcode.ContainsKey(item.CdName + "|" + item.CdType) == false)
                     {
                         List <AllCode_Info> _lst = new List <AllCode_Info>();
                         _lst.Add(item);
                         c_Allcode[item.CdName + "|" + item.CdType] = _lst;
                     }
                     else
                     {
                         List <AllCode_Info> _lst = (List <AllCode_Info>)c_Allcode[item.CdName + "|" + item.CdType];
                         _lst.Add(item);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
     }
 }
Exemplo n.º 2
0
        Hashtable c_hs_color = new Hashtable(); // Danh sách màu Key ID
        #endregion

        #region Events

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                dpReceiveDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
                txtProduct_Name.Focus();

                Category_Controller  _Category_Controller = new Category_Controller();
                List <Category_Info> _lst = _Category_Controller.Get_All();

                cboItem_Type.DisplayMemberPath = "Category_Name";
                cboItem_Type.SelectedValuePath = "Category_Id";

                cboItem_Type.ItemsSource   = _lst;
                cboItem_Type.SelectedIndex = 0;

                Supplier_Controller  _Supplier_Controller = new Supplier_Controller();
                List <Supplier_Info> _lst1 = _Supplier_Controller.Get_All();

                cboSupplier.DisplayMemberPath = "Supplier_Name";
                cboSupplier.SelectedValuePath = "Supplier_Id";

                cboSupplier.ItemsSource   = _lst1;
                cboSupplier.SelectedIndex = 0;


                Allcode_Controller  _Allcode_Controller = new Allcode_Controller();
                List <AllCode_Info> _lst2 = _Allcode_Controller.Get_AllCode_ByCdNameCdType("PRODUCT", "UNIT");

                cboUnit.SelectedValuePath = "CdValue";
                cboUnit.DisplayMemberPath = "Content";
                cboUnit.ItemsSource       = _lst2;
                cboUnit.SelectedIndex     = 0;

                Create_SoHoaDon();
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemplo n.º 3
0
        void LoadData()
        {
            try
            {
                dpSaleDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
                txtProductCode.Focus();

                Allcode_Controller  _Allcode_Controller = new Allcode_Controller();
                List <AllCode_Info> _lst = _Allcode_Controller.Get_AllCode_ByCdNameCdType("SALE_HEADER", "PAY_TYPE");

                cboPayType.SelectedValuePath = "CdValue";
                cboPayType.DisplayMemberPath = "Content";
                cboPayType.ItemsSource       = _lst;
                cboPayType.SelectedIndex     = 0;

                Create_Sale_Header_Code();
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemplo n.º 4
0
        private void ThreadSystemCheck()
        {
            try
            {
                #region 0. Kiem tra ket noi database WCF
                Allcode_Controller _AllCodeController = new Allcode_Controller();

                c_msgNotify = "Kiểm tra kết nối đến WCF service ...";
                ShowLabel(MsgType.NORMAL, c_msgNotify, 10);

                bool _Result = _AllCodeController.AllCode_checkWCF();
                if (_Result == false)
                {
                    c_LoadCommonDataStatus = 1; //kiẻm tra bị lôi
                    c_msgNotify            = "Error: Lỗi kết nối đến WCF service";
                    ShowLabel(MsgType.ERROR, c_msgNotify, 10);
                    return;
                }
                #endregion

                #region 1 Auto Update

                Controller  _Controller  = new Controller();
                VersionInfo _VersionInfo = _Controller.GetNewnestVersion();
                if (_VersionInfo.Version == "0.0.0.0")
                {
                    //c_CheckOK = false;
                    //ShowLabel(MsgType.ERROR, "Không kết nối được với máy chủ.Không thể tự động cập nhật phiên bản mới !");
                    //return;
                }
                else
                {
                    if (_LocalVersion.Version != _VersionInfo.Version)
                    {
                        c_msgNotify = "Download phiên bản mới";
                        ShowLabel(MsgType.NORMAL, c_msgNotify, 20);
                        if (_Controller.DownloadUpdateFile() == true)
                        {
                            if (System.IO.File.Exists("AutoInstall.exe"))
                            {
                                System.Diagnostics.Process.Start("AutoInstall.exe", "StartsInternational");
                                //  CloseApp();
                            }
                        }
                    }
                }
                #endregion

                #region 2. Kiem tra ket noi database

                c_msgNotify = "Kiểm tra thông số hệ thống";
                ShowLabel(MsgType.NORMAL, c_msgNotify, 30);

                c_msgNotify = "Kiểm tra kết nối đến Database";
                ShowLabel(MsgType.NORMAL, c_msgNotify, 50);
                if (_AllCodeController.AllCode_checkDatabase() == false)
                {
                    c_LoadCommonDataStatus = 1; //kiẻm tra bị lôi
                    c_msgNotify            = "Error: Lỗi kết nối đến Database";
                    ShowLabel(MsgType.ERROR, c_msgNotify, 50);
                    return;
                }

                #endregion

                #region 3.Load CommonData

                try
                {
                    c_msgNotify = "Load dữ liệu tham số hệ thống ...";
                    ShowLabel(MsgType.NORMAL, c_msgNotify, 70);
                    Common.DBMemory.LoadParamSystem();
                }
                catch (Exception ex)
                {
                    c_LoadCommonDataStatus = 1;
                    c_msgNotify            = "Error: tham số hệ thống";
                    ShowLabel(MsgType.ERROR, c_msgNotify, 70);
                    CommonData.log.Error(ex.ToString());
                    return;
                }

                #endregion

                c_LoadCommonDataStatus = 2;
                Thread.Sleep(2000);
                ShowLabel(MsgType.NORMAL, "Kết nối thành công", 90);

                HidenLoading();
            }
            catch
            {
                c_LoadCommonDataStatus = 1; //kiẻm tra bị lôi
                c_msgNotify            = "Error: Lỗi khi load tham số hệ thống";
                ShowLabel(MsgType.ERROR, c_msgNotify, 0);
            }
        }