Ejemplo n.º 1
0
        /// <summary>
        /// Xem dữ liệu
        /// </summary>
        private void onView(int id)
        {
            UserControl userControl = null;
            string      tittle      = DatabaseConstant.layNgonNguTieuDeForm(this.Function);
            Window      frm         = new Window();

            frm.Title = tittle;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);
            switch (company)
            {
            case ApplicationConstant.DonViSuDung.BANTAYVANG:
                userControl = new ucNhomCT_01();
                break;

            default:
                userControl = new ucNhomCT_01();
                break;
            }
            PropertyInfo fieldAction = userControl.GetType().GetProperty("Action");

            fieldAction.SetValue(userControl, DatabaseConstant.Action.XEM, null);
            fieldAction = userControl.GetType().GetProperty("Id");
            fieldAction.SetValue(userControl, id, null);
            MethodInfo mi = userControl.GetType().GetMethod("beforeViewFromList");

            mi.Invoke(userControl, null);
            //LoadTreeCT dlgLoadTreeCT = new LoadTreeCT(userControl.beforeViewFromList);
            //dlgLoadTreeCT();
            frm.Content = userControl;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Xử lý sự kiện thêm
        /// </summary>
        private void Them()
        {
            UserControl userControl = null;
            string      tittle      = DatabaseConstant.layNgonNguTieuDeForm(this.function);
            Window      frm         = new Window();

            frm.Title = tittle;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);
            switch (company)
            {
            case ApplicationConstant.DonViSuDung.BANTAYVANG:
                userControl = new ucKhuVucCT_01();
                break;

            default:
                userControl = new ucKhuVucCT_01();
                break;
            }
            FieldInfo fieldAction = userControl.GetType().GetField("action");

            fieldAction.SetValue(userControl, DatabaseConstant.Action.THEM);
            //MethodInfo mi = userControl.GetType().GetMethod("SetDataForm");
            //object[] para = new object[1] { id };
            //mi.Invoke(userControl, para);
            //LoadDuLieuCT dlgLoadDuLieuCT = new LoadDuLieuCT(userControl.beforeViewFromList);
            //dlgLoadDuLieuCT();
            frm.Content = userControl;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
        }
        public LoginWithConfigWindow()
        {
            InitializeComponent();
            process = new ZAMainAppProcess();

            //Icon & title setting
            CommonFunction.setIcon(this);
            this.Title += " - " + ClientInformation.ShortName;

            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);

            if (company == ApplicationConstant.DonViSuDung.BINHKHANH)
            {
                lblLanguage.Visibility = Visibility.Hidden;
                cboLanguage.Visibility = Visibility.Hidden;
                lblTitle.Visibility    = Visibility.Visible;
            }

            string        ServerPattern = ClientInformation.ServerList;
            Server        server        = new Server();
            List <Server> ServerList    = server.getServerList(ServerPattern);

            foreach (Server item in ServerList)
            {
                MenuItem mnuItem = new MenuItem();
                mnuItem.Name   = "" + item.ServerName;
                mnuItem.Header = "" + item.ServerName;
                mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort;
                if (item.ServerName.Equals(ClientInformation.ServerName))
                {
                    mnuItem.Icon = new Image {
                        Source = new BitmapImage(new Uri(@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                    };
                }
                mnuItem.Click += mnu_Click;

                mnuConfig.Items.Add(mnuItem);
            }
        }
Ejemplo n.º 4
0
        public int CapNhatKheUocDaTatToan(ApplicationConstant.DonViSuDung CompanyCode)
        {
            int SoLuongKheUoc = 0;

            try
            {
                if (CompanyCode.Equals(ApplicationConstant.DonViSuDung.BINHKHANH))
                {
                    string     nativeQuery = "";
                    DS_TruyVan dsTruyVan   = new DS_TruyVan();
                    DataSet    ds          = new DataSet();

                    // Lay so luong trong TD_KUOCVM
                    nativeQuery = "SELECT COUNT(*) FROM TD_KUOCVM WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                    ds = dsTruyVan.GetData(nativeQuery);
                    string SoLuongKUOCVM = "";
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        SoLuongKUOCVM = ds.Tables[0].Rows[0][0].ToString();
                    }
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "KUOCVM: " + SoLuongKUOCVM);

                    // Lay so luong trong TD_KUOCVM_LSU
                    nativeQuery = "SELECT COUNT(*) FROM TD_KUOCVM_LSU WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                    ds = dsTruyVan.GetData(nativeQuery);
                    string SoLuongKUOCVM_LSU = "";
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        SoLuongKUOCVM_LSU = ds.Tables[0].Rows[0][0].ToString();
                    }
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "KUOCVM_LSU: " + SoLuongKUOCVM_LSU);

                    if (SoLuongKUOCVM.Equals(SoLuongKUOCVM_LSU) && !SoLuongKUOCVM.Equals("0"))
                    {
                        SoLuongKheUoc = Int32.Parse(SoLuongKUOCVM);

                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "KUOCVM PROCESSING");
                        nativeQuery = "SELECT MA_KUOCVM, SO_DU, SO_TIEN_GIAI_NGAN, GOC_DA_THU, LAI_PHAI_THU, LAI_DA_THU FROM TD_KUOCVM WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                        ds = dsTruyVan.GetData(nativeQuery);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                string MA_KUOCVM         = ds.Tables[0].Rows[i][0].ToString();
                                string SO_DU             = ds.Tables[0].Rows[i][1].ToString();
                                string SO_TIEN_GIAI_NGAN = ds.Tables[0].Rows[i][2].ToString();
                                string GOC_DA_THU        = ds.Tables[0].Rows[i][3].ToString();
                                string LAI_PHAI_THU      = ds.Tables[0].Rows[i][4].ToString();
                                string LAI_DA_THU        = ds.Tables[0].Rows[i][5].ToString();
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "MA_KUOCVM, SO_DU, SO_TIEN_GIAI_NGAN, GOC_DA_THU, LAI_PHAI_THU, LAI_DA_THU");
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, MA_KUOCVM + ", " + SO_DU + ", " + SO_TIEN_GIAI_NGAN + ", " + GOC_DA_THU + ", " + LAI_PHAI_THU + ", " + LAI_DA_THU);
                            }
                            nativeQuery = "UPDATE TD_KUOCVM SET SO_DU = 0 WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                            ds = dsTruyVan.GetData(nativeQuery);
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, ds.ToString());
                        }


                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "KUOCVM_LSU PROCESSING");
                        nativeQuery = "SELECT MA_KUOCVM, SO_DU, SO_TIEN_GIAI_NGAN, GOC_DA_THU, LAI_PHAI_THU, LAI_DA_THU FROM TD_KUOCVM_LSU WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                        ds = dsTruyVan.GetData(nativeQuery);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                string MA_KUOCVM         = ds.Tables[0].Rows[i][0].ToString();
                                string SO_DU             = ds.Tables[0].Rows[i][1].ToString();
                                string SO_TIEN_GIAI_NGAN = ds.Tables[0].Rows[i][2].ToString();
                                string GOC_DA_THU        = ds.Tables[0].Rows[i][3].ToString();
                                string LAI_PHAI_THU      = ds.Tables[0].Rows[i][4].ToString();
                                string LAI_DA_THU        = ds.Tables[0].Rows[i][5].ToString();
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "MA_KUOCVM, SO_DU, SO_TIEN_GIAI_NGAN, GOC_DA_THU, LAI_PHAI_THU, LAI_DA_THU");
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, MA_KUOCVM + ", " + SO_DU + ", " + SO_TIEN_GIAI_NGAN + ", " + GOC_DA_THU + ", " + LAI_PHAI_THU + ", " + LAI_DA_THU);
                            }
                            nativeQuery = "UPDATE TD_KUOCVM_LSU SET SO_DU = 0 WHERE SO_DU > 0 AND TTHAI_KUOC = 'DTT'";
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                            ds = dsTruyVan.GetData(nativeQuery);
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, ds.ToString());
                        }
                    }
                }

                return(SoLuongKheUoc);
            }
            catch (System.Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public int CapNhatSoTietKiem(ApplicationConstant.DonViSuDung CompanyCode)
        {
            int SoLuongSoTietKiem = 0;

            try
            {
                if (CompanyCode.Equals(ApplicationConstant.DonViSuDung.BINHKHANH))
                {
                    string     nativeQuery = "";
                    DS_TruyVan dsTruyVan   = new DS_TruyVan();
                    DataSet    ds          = new DataSet();

                    // Lay so luong trong TD_KUOCVM
                    nativeQuery = "SELECT COUNT(*) FROM BL_TIEN_GUI where DU_CHI_LAI is NULL";
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                    ds = dsTruyVan.GetData(nativeQuery);
                    string SoLuongSo = "";
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        SoLuongSo = ds.Tables[0].Rows[0][0].ToString();
                    }
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "SoLuongSo: " + SoLuongSo);

                    // Lay so luong trong TD_KUOCVM_LSU
                    nativeQuery = "SELECT COUNT(*) FROM BL_TIEN_GUI_LSU where DU_CHI_LAI is NULL";
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                    ds = dsTruyVan.GetData(nativeQuery);
                    string SoLuongSo_LSU = "";
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        SoLuongSo_LSU = ds.Tables[0].Rows[0][0].ToString();
                    }
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "SoLuongSo_LSU: " + SoLuongSo_LSU);

                    if (SoLuongSo.Equals(SoLuongSo_LSU) && !SoLuongSo.Equals("0"))
                    {
                        SoLuongSoTietKiem = Int32.Parse(SoLuongSo);

                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "BL_TIEN_GUI PROCESSING");
                        nativeQuery = "SELECT MA_KHANG, SO_SO_TG FROM BL_TIEN_GUI where DU_CHI_LAI is NULL";
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                        ds = dsTruyVan.GetData(nativeQuery);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                string MA_KHANG = ds.Tables[0].Rows[i][0].ToString();
                                string SO_SO_TG = ds.Tables[0].Rows[i][1].ToString();
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "MA_KHANG, SO_SO_TG");
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, MA_KHANG + ", " + SO_SO_TG);
                            }
                            nativeQuery = "UPDATE BL_TIEN_GUI SET DU_CHI_LAI = 0 WHERE DU_CHI_LAI is NULL";
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                            ds = dsTruyVan.GetData(nativeQuery);
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, ds.ToString());
                        }


                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "BL_TIEN_GUI_LSU PROCESSING");
                        nativeQuery = "SELECT MA_KHANG, SO_SO_TG FROM BL_TIEN_GUI_LSU where DU_CHI_LAI is NULL";
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                        ds = dsTruyVan.GetData(nativeQuery);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                string MA_KHANG = ds.Tables[0].Rows[i][0].ToString();
                                string SO_SO_TG = ds.Tables[0].Rows[i][1].ToString();
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, "MA_KHANG, SO_SO_TG");
                                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, MA_KHANG + ", " + SO_SO_TG);
                            }
                            nativeQuery = "UPDATE BL_TIEN_GUI_LSU SET DU_CHI_LAI = 0 WHERE DU_CHI_LAI is NULL";
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, nativeQuery);
                            ds = dsTruyVan.GetData(nativeQuery);
                            LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.BUS, ds.ToString());
                        }
                    }
                }

                return(SoLuongSoTietKiem);
            }
            catch (System.Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public LoginWindow()
        {
            InitializeComponent();

            // IP, MAC Address
            new ClientInitProcess().docThongTinCauHinhClient(1);

            // No IP, MAC Address
            //docThongTinCauHinhClient(1);

            if (!ClientInformation.Theme.Equals("default"))
            {
                SetThemes();
            }

            /* LANGUAGE */
            if (!ClientInformation.LanguageList.Equals(""))
            {
                string          LanguagePattern = ClientInformation.LanguageList;
                List <Language> LanguageList    = (new Language()).getLanguageList(LanguagePattern);

                int    i     = 0;
                int    index = 0;
                string value = "";
                foreach (Language e in LanguageList)
                {
                    RadComboBoxItem item = new RadComboBoxItem();
                    item.Content = e.LanguageName; item.Tag = e.LanguageCode;
                    cboLanguage.Items.Add(item);

                    if (e.LanguageStatus.Equals("1"))
                    {
                        index = i;
                        value = e.LanguageStatus;
                    }
                    ++i;
                }

                cboLanguage.SelectedIndex = index;
                //cboLanguage.SelectedValue = value;
            }
            else
            {
            }
            /* LANGUAGE */

            process = new ZAMainAppProcess();

            //Icon & title setting
            CommonFunction.setIcon(this);

            //Set licence Aspose Words and Cells
            MemoryStream aspLic = new MemoryStream();
            StreamWriter sw     = new StreamWriter(aspLic, Encoding.UTF8);

            Aspose.Words.License licenseWord = new Aspose.Words.License();
            //Set the license of Aspose.Cells to avoid the evaluation
            //limitations
            sw.WriteLine(BusinessConstant.asposeWordLic);
            sw.Flush();
            aspLic.Position = 0;
            licenseWord.SetLicense(aspLic);

            Aspose.Cells.License licenseExcel = new Aspose.Cells.License();
            //Set the license of Aspose.Cells to avoid the evaluation
            //limitations
            sw.WriteLine(BusinessConstant.asposeWordLic);
            sw.Flush();
            aspLic.Position = 0;
            licenseExcel.SetLicense(aspLic);

            ApplicationConstant.DonViSuDung company = ApplicationConstant.layDonViSuDung(ClientInformation.Company);

            if (company == ApplicationConstant.DonViSuDung.BINHKHANH)
            {
                lblLanguage.Visibility = Visibility.Hidden;
                cboLanguage.Visibility = Visibility.Hidden;
                lblTitle.Visibility    = Visibility.Visible;

                //imgConfig.Visibility = Visibility.Collapsed;
                string ServerPattern = ClientInformation.ServerList;
                if (!string.IsNullOrEmpty(ServerPattern))
                {
                    Server        server     = new Server();
                    List <Server> ServerList = server.getServerList(ServerPattern);

                    if (ServerList.Count <= 1)
                    {
                        imgConfig.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        foreach (Server item in ServerList)
                        {
                            MenuItem mnuItem = new MenuItem();
                            mnuItem.Name   = "" + item.ServerName;
                            mnuItem.Header = "" + item.ServerName;
                            mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort + "#" + item.ServerCode;
                            if (item.ServerName.Equals(ClientInformation.ServerName))
                            {
                                mnuItem.Icon = new Image {
                                    Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                                };
                            }
                            mnuItem.Click += mnu_Click;

                            mnuConfig.Items.Add(mnuItem);
                        }
                    }
                }
                else
                {
                    imgConfig.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                if (company == ApplicationConstant.DonViSuDung.BIDV ||
                    company == ApplicationConstant.DonViSuDung.BIDV_BLF)
                {
                    //cboLanguage.SelectedIndex = 1;
                }

                //imgConfig.Visibility = Visibility.Collapsed;
                string ServerPattern = ClientInformation.ServerList;
                if (!string.IsNullOrEmpty(ServerPattern))
                {
                    Server        server     = new Server();
                    List <Server> ServerList = server.getServerList(ServerPattern);

                    if (ServerList.Count <= 1)
                    {
                        imgConfig.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        foreach (Server item in ServerList)
                        {
                            MenuItem mnuItem = new MenuItem();
                            mnuItem.Name   = "" + item.ServerName;
                            mnuItem.Header = "" + item.ServerName;
                            mnuItem.Uid    = "" + item.ServerIP + "#" + item.ServerPort + "#" + item.ServerCode;
                            if (item.ServerName.Equals(ClientInformation.ServerName))
                            {
                                mnuItem.Icon = new Image {
                                    Source = new BitmapImage(new Uri(@"pack://application:,,,/Utilities.Common;component/Images/Action/approve.png", UriKind.RelativeOrAbsolute)), Width = 12, Height = 12
                                };
                            }
                            mnuItem.Click += mnu_Click;

                            mnuConfig.Items.Add(mnuItem);
                        }
                    }
                }
                else
                {
                    imgConfig.Visibility = Visibility.Collapsed;
                }
            }
            cboLanguage.SelectionChanged += cboLanguage_SelectionChanged;
        }
Ejemplo n.º 7
0
 public int CapNhatSoTietKiem(ApplicationConstant.DonViSuDung CompanyCode)
 {
     return(new DS_ZAMainApp().CapNhatSoTietKiem(CompanyCode));
 }
Ejemplo n.º 8
0
 public int CapNhatKheUocDaTatToan(ApplicationConstant.DonViSuDung CompanyCode)
 {
     return(new DS_ZAMainApp().CapNhatKheUocDaTatToan(CompanyCode));
 }