Exemplo n.º 1
0
        public static ABCBaseScreen GetABCScreen(String strLayoutXMLPath, STViewsInfo viewInfo, ViewMode mode)
        {
            //if ( ABCBaseProvider.BaseInstance.CheckViewPermission( viewInfo.STViewNo , ViewPermission.AllowView )==false )
            //{
            //    ABCHelper.ABCMessageBox.Show( "Bạn không đủ quyền hạn sử dụng tính năng này!" , "Thông báo" , MessageBoxButtons.OK , MessageBoxIcon.Error );
            //    return null;
            //}

            ABCBaseScreen screen = null;
            Type          type   = null;

            if (viewInfo != null)
            {
                type = GetABCScreenType(viewInfo.STViewID);
            }

            if (type == null)
            {
                type = typeof(ABCBaseScreen);
            }

            screen = (ABCBaseScreen)ABCDynamicInvoker.CreateInstanceObject(type);
            if (screen != null)
            {
                screen.LoadScreen(strLayoutXMLPath, mode);
            }

            return(screen);
        }
Exemplo n.º 2
0
        public virtual bool ReCalculate(BusinessObject obj, bool isSave)
        {
            if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colLockStatus))
            {
                if (ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colLockStatus).ToString() == ABCCommon.ABCConstString.LockStatusLocked)
                {
                    return(false);
                }
            }

            if (obj.GetID() != Guid.Empty)
            {
                Dictionary <String, IEnumerable <BusinessObject> > lstObjecItems = new Dictionary <string, IEnumerable <BusinessObject> >();
                foreach (GEVoucherItemsInfo configItem in ConfigItems)
                {
                    if (!DataStructureProvider.IsForeignKey(configItem.ItemTableName, configItem.ItemFKField))
                    {
                        continue;
                    }

                    BusinessObjectController itemCtrl = BusinessControllerFactory.GetBusinessController(configItem.ItemTableName);

                    if (!lstObjecItems.ContainsKey(configItem.ItemTableName))
                    {
                        lstObjecItems.Add(configItem.ItemTableName, (IEnumerable <BusinessObject>)itemCtrl.GetListByForeignKey(configItem.ItemFKField, obj.GetID()));
                    }
                }

                return(ReCalculate(obj, lstObjecItems, false, String.Empty, isSave));
            }

            return(ReCalculate(obj, null, false, String.Empty, isSave));
        }
Exemplo n.º 3
0
        public virtual bool ReCalculate(BusinessObject obj, Dictionary <String, IEnumerable <BusinessObject> > lstObjecItems, bool isCalcMainOnly, String strAfterValidateFieldName, bool isSave)
        {
            if (obj == null || obj.GetID() == Guid.Empty)
            {
                return(false);
            }

            if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colLockStatus))
            {
                if (ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colLockStatus).ToString() == ABCCommon.ABCConstString.LockStatusLocked)
                {
                    return(false);
                }
            }

            if (!BeforeReCalculate(obj, lstObjecItems, isCalcMainOnly, strAfterValidateFieldName))
            {
                return(false);
            }

            if (!DoReCalculate(obj, lstObjecItems, isCalcMainOnly, strAfterValidateFieldName, isSave))
            {
                return(false);
            }

            AfterReCalculate(obj, lstObjecItems, isCalcMainOnly, strAfterValidateFieldName);
            return(true);
        }
Exemplo n.º 4
0
        public static object GetTemplateObject(Type type)
        {
            object obj = null;

            if (TemplateList.TryGetValue(type.FullName, out obj))
            {
                return(obj);
            }

            if (typeof(Component).IsAssignableFrom(type))
            {
                obj = HostSurfaceManager.GetTemplateComponent(type);
            }
            else
            {
                obj = GetTemplateObjectFromSpecialType(type);
                if (obj == null)
                {
                    obj = ABCDynamicInvoker.CreateInstanceObject(type);
                }
            }
            if (obj != null)
            {
                TemplateList.Add(type.FullName, obj);
            }
            return(obj);
        }
Exemplo n.º 5
0
        public void PopulateControls(ABCView view, String BusName, String strTableName)
        {
            ViewOwner  = view;
            DataSource = BusName;
            TableName  = strTableName;
            int iCount = 0;

            foreach (DataConfigProvider.FieldConfig fieldConfig in DataConfigProvider.TableConfigList[strTableName].FieldConfigList.Values)
            {
                //if ( fieldConfig.IsDefault )
                //{
                String strDiplay = DataConfigProvider.GetFieldCaption(strTableName, fieldConfig.FieldName);
                if (strDiplay == fieldConfig.FieldName)
                {
                    continue;
                }

                ABCBindingBaseEdit ctrl;

                if (view.Mode == ViewMode.Design)
                {
                    ctrl = (ABCBindingBaseEdit)view.Surface.DesignerHost.CreateComponent(typeof(ABCBindingBaseEdit));
                }
                else
                {
                    ctrl = (ABCBindingBaseEdit)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCBindingBaseEdit));
                }

                ABCBindingInfo bindInfo = new ABCBindingInfo();
                bindInfo.BusName   = BusName;
                bindInfo.TableName = TableName;
                bindInfo.FieldName = fieldConfig.FieldName;
                List <Type> lstType = ABCControls.ABCPresentHelper.GetControlTypes(TableName, fieldConfig.FieldName);
                if (lstType.Count <= 0)
                {
                    continue;
                }
                foreach (Type type in lstType)
                {
                    if (type != typeof(ABCSearchControl))
                    {
                        bindInfo.ControlType = lstType[0];
                        break;
                    }
                }
                ctrl.Initialize(view, bindInfo);
                ctrl.Parent = this;
                iCount++;
                //}
            }
            if (iCount % 2 != 0)
            {
                iCount++;
            }
            iCount    = iCount / 2;
            this.Size = new Size(229 * 2 + 4 * 3, 20 * iCount + (iCount + 1) * 5);
        }
Exemplo n.º 6
0
        public static bool GenerateCurrencyValue(BusinessObject obj)
        {
            bool isModified = false;

            String strFK_GECurrencyID = DataStructureProvider.GetForeignKeyOfTableName(obj.AATableName, "GECurrencys");

            if (!String.IsNullOrWhiteSpace(strFK_GECurrencyID))
            {
                if (AppCurrencyID == Guid.Empty)
                {
                    String strQuery = @"SELECT FK_GECurrencyID FROM GEAppConfigs";
                    AppCurrencyID = ABCHelper.DataConverter.ConvertToGuid(BusinessObjectController.GetData(strQuery));
                }
                ABCDynamicInvoker.SetValue(obj, strFK_GECurrencyID, AppCurrencyID);
                if (AppCurrencyID != Guid.Empty && DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colExchangeRate))
                {
                    object objDate    = DateTime.MinValue;
                    String strDateCol = String.Empty;
                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                    {
                        strDateCol = ABCCommon.ABCConstString.colCreateTime;
                    }
                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                    {
                        strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                    }

                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colVoucherDate))
                    {
                        strDateCol = ABCCommon.ABCConstString.colVoucherDate;
                    }

                    if (!String.IsNullOrWhiteSpace(strDateCol))
                    {
                        objDate = ABCDynamicInvoker.GetValue(obj, strDateCol);

                        object objOldValue = ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colExchangeRate);

                        if (objDate != null && objDate is DateTime)
                        {
                            object objNewValue = CurrencyProvider.GetExchangeRate(AppCurrencyID, Convert.ToDateTime(objDate));
                            ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colExchangeRate, objNewValue);
                            isModified = isModified || (objOldValue != objNewValue);
                        }
                        else if (objDate != null && objDate is Nullable <DateTime> )
                        {
                            object objNewValue = CurrencyProvider.GetExchangeRate(AppCurrencyID, (objDate as Nullable <DateTime>).Value);
                            ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colExchangeRate, objNewValue);
                            isModified = isModified || (objOldValue != objNewValue);
                        }
                    }
                }
            }

            return(isModified);
        }
Exemplo n.º 7
0
 public static AccrossStructInfo GetAccrossStructInfo(BusinessObject baseObj, Guid iFieldValue, String strFieldString)
 {
     if (strFieldString.Contains(":") && strFieldString.Split(':')[0] == "ID" && DataStructureProvider.IsTableColumn(baseObj.AATableName, "TableName"))
     {
         object strIDTableName = ABCDynamicInvoker.GetValue(baseObj, "TableName");
         if (strIDTableName != null)
         {
             return(GetAccrossStructInfo(baseObj.AATableName, iFieldValue, strFieldString, strIDTableName.ToString()));
         }
     }
     return(GetAccrossStructInfo(baseObj.AATableName, iFieldValue, strFieldString));
 }
Exemplo n.º 8
0
        public void PopulateControls(ABCView view, String BusName, String strTableName)
        {
            ViewOwner  = view;
            DataSource = BusName;
            TableName  = strTableName;
            int iCount            = 0;
            ABCSearchControl ctrl = null;

            foreach (DataConfigProvider.FieldConfig fieldConfig in DataConfigProvider.TableConfigList[strTableName].FieldConfigList.Values)
            {
                if (fieldConfig.InUse == false)
                {
                    continue;
                }

                if (DataStructureProvider.IsPrimaryKey(strTableName, fieldConfig.FieldName) ||
                    DataStructureProvider.IsForeignKey(strTableName, fieldConfig.FieldName))
                {
                    continue;
                }

                if (fieldConfig.IsDefault)
                {
                    if (view != null && view.Mode == ViewMode.Design)
                    {
                        ctrl = (ABCSearchControl)view.Surface.DesignerHost.CreateComponent(typeof(ABCSearchControl));
                    }
                    else
                    {
                        ctrl = (ABCSearchControl)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCSearchControl));
                    }

                    ABCSearchInfo searchInfo = new ABCSearchInfo();
                    searchInfo.DataSource = BusName;
                    searchInfo.TableName  = TableName;
                    searchInfo.DataMember = fieldConfig.FieldName;

                    ctrl.Initialize(view, searchInfo);
                    ctrl.Parent = this.DropZone;
                    iCount++;
                }
            }

            if (iCount % 2 != 0)
            {
                iCount++;
            }
            iCount = iCount / 2;
            if (ctrl != null)
            {
                this.Size = new Size(ctrl.Width * 2 + 4 * 3, 20 * iCount + (iCount + 1) * 5 + 25);
            }
        }
Exemplo n.º 9
0
        public static Numbering GetNumberingConfig(BusinessObject obj)
        {
            if (NumberingConfigs == null || NumberingTypes == null)
            {
                InitializeNumberings();
            }

            foreach (Numbering config in NumberingConfigs)
            {
                if (config.TableName != obj.AATableName)
                {
                    continue;
                }

                if (!String.IsNullOrWhiteSpace(config.FieldCondition) && !String.IsNullOrWhiteSpace(config.FieldValue))
                {
                    object fileValue = ABCDynamicInvoker.GetValue(obj, config.FieldCondition);
                    if (fileValue == null || fileValue == DBNull.Value || fileValue.ToString() != config.FieldValue)
                    {
                        continue;
                    }
                }

                if (!String.IsNullOrWhiteSpace(config.ConditionString))
                {
                    String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false);
                    strQuery = QueryGenerator.AddCondition(strQuery, config.ConditionString);
                    strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@"{0}='{1}'", DataStructureProvider.GetPrimaryKeyColumn(obj.AATableName), obj.GetID()));
                    object objCount = BusinessObjectController.GetData(strQuery);
                    if (objCount == null || objCount == DBNull.Value || Convert.ToInt32(objCount.ToString()) <= 0)
                    {
                        continue;
                    }
                }

                return(config);
            }

            return(null);
        }
Exemplo n.º 10
0
        public static void CalculateCredit(String strTableName, Guid ID)
        {
            List <Guid> lstPartnerIDs     = new List <Guid>();
            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(strTableName);

            if (ctrl != null)
            {
                BusinessObject obj = ctrl.GetObjectByID(ID);
                if (obj != null)
                {
                    String strPartnerFKCol = DataStructureProvider.GetForeignKeyOfTableName(strTableName, "MAPartners");
                    if (String.IsNullOrWhiteSpace(strPartnerFKCol) == false)
                    {
                        Guid partnerID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strPartnerFKCol));
                        if (partnerID != Guid.Empty && !lstPartnerIDs.Contains(partnerID))
                        {
                            lstPartnerIDs.Add(partnerID);
                        }
                    }

                    foreach (GEVoucherItemsInfo voucherItem in VoucherProvider.GetConfigItems(strTableName, ""))
                    {
                        strPartnerFKCol = DataStructureProvider.GetForeignKeyOfTableName(voucherItem.ItemTableName, "MAPartners");
                        if (String.IsNullOrWhiteSpace(strPartnerFKCol) == false)
                        {
                            Guid partnerID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strPartnerFKCol));
                            if (partnerID != Guid.Empty && !lstPartnerIDs.Contains(partnerID))
                            {
                                lstPartnerIDs.Add(partnerID);
                            }
                        }
                    }
                }
            }
            foreach (Guid partnerID in lstPartnerIDs)
            {
                CreditProvider.CalculateCredit(partnerID);
            }
        }
Exemplo n.º 11
0
        public static Component CreateComponent(ABCView ViewOwner, Type type)
        {
            Component comp = null;

            try
            {
                if (ViewOwner.Mode == ViewMode.Design)
                {
                    comp = (Component)ViewOwner.Surface.DesignerHost.CreateComponent(type);
                }
                else
                {
                    comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(comp);
        }
Exemplo n.º 12
0
 void ABCCheckEdit_CheckStateChanged(object sender, EventArgs e)
 {
     if (OwnerView != null && OwnerView.Mode != ViewMode.Design && String.IsNullOrWhiteSpace(GridControl) == false)
     {
         Control[] controls = OwnerView.Controls.Find(GridControl, true);
         if (controls.Length > 0)
         {
             if (controls[0] is ABCGridControl)
             {
                 ABCGridControl grid = controls[0] as ABCGridControl;
                 if (grid.GridDefaultView.Columns[ABCCommon.ABCConstString.colSelected] != null)
                 {
                     if (grid.GridDataSource is System.Windows.Forms.BindingSource && (grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource is System.Collections.IList)
                     {
                         foreach (BusinessObject obj in ((grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource as System.Collections.IList))
                         {
                             ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colSelected, this.CheckState == System.Windows.Forms.CheckState.Checked);
                         }
                     }
                 }
             }
             if (controls[0] is ABCGridBandedControl)
             {
                 ABCGridBandedControl grid = controls[0] as ABCGridBandedControl;
                 if (grid.BandedView.Columns[ABCCommon.ABCConstString.colSelected] != null)
                 {
                     if (grid.GridDataSource is System.Windows.Forms.BindingSource && (grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource is System.Collections.IList)
                     {
                         foreach (BusinessObject obj in ((grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource as System.Collections.IList))
                         {
                             ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colSelected, this.CheckState == System.Windows.Forms.CheckState.Checked);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
        public static bool CalculateMainOnly(BaseVoucher voucher, BusinessObject obj, Dictionary <String, IEnumerable <BusinessObject> > lstObjecItems, String strAferValidateFieldName, bool isSave)
        {
            if (FormulasList == null)
            {
                InitFormulas();
            }

            if (!FormulasList.ContainsKey(obj.AATableName))
            {
                return(false);
            }

            bool isCalculated = false;

            Dictionary <String, double> lstVariables = new Dictionary <string, double>();
            bool isContinue = false;

            foreach (GEFormulaItemsInfo formula in FormulasList[obj.AATableName].Values)
            {
                if (String.IsNullOrWhiteSpace(formula.FormulaName))
                {
                    continue;
                }

                #region isNeedCalc
                bool isNeedCalc = isContinue;
                if (!isNeedCalc)
                {
                    if (formula.IsVariable)
                    {
                        isNeedCalc = true;
                    }
                    else
                    {
                        if (String.IsNullOrWhiteSpace(strAferValidateFieldName))
                        {
                            isNeedCalc = true;
                        }
                        else
                        {
                            if (FormulasList[obj.AATableName].Values.Count(t => t.FormulaName == strAferValidateFieldName) > 0)
                            {
                                if (formula.FormulaName == strAferValidateFieldName)
                                {
                                    isContinue = true;
                                    continue;
                                }
                            }
                            else
                            {
                                if (DataConfigProvider.GetFieldSortOrder(obj.AATableName, strAferValidateFieldName) <= DataConfigProvider.GetFieldSortOrder(obj.AATableName, formula.FormulaName))
                                {
                                    isContinue = true;
                                    isNeedCalc = true;
                                }
                            }
                        }
                    }
                }

                if (!isNeedCalc)
                {
                    continue;
                }
                #endregion

                object objAmt = null;
                if (formula.IsUseQuery && !String.IsNullOrWhiteSpace(formula.QueryString))
                {
                    #region Query
                    String strQuery = formula.QueryString.Replace("{TableName}", obj.AATableName);
                    if (obj.GetID() != Guid.Empty)
                    {
                        strQuery = strQuery.Replace("{ID}", obj.GetID().ToString());
                    }

                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        if (strQuery.Contains("{" + strProperty + "}"))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strProperty);
                            if (objValue == null || objValue == DBNull.Value)
                            {
                                strQuery = strQuery.Replace("{" + strProperty + "}", "NULL");
                            }
                            else
                            {
                                strQuery = strQuery.Replace("{" + strProperty + "}", objValue.ToString());
                            }
                        }
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        if (strQuery.Contains("{" + strVariableName + "}"))
                        {
                            strQuery = strQuery.Replace("{" + strVariableName + "}", lstVariables[strVariableName].ToString());
                        }
                    }
                    #endregion

                    objAmt = BusinessObjectController.GetData(strQuery);
                }
                else if (formula.IsUseFormula && !String.IsNullOrWhiteSpace(formula.Formula))
                {
                    String strExpression = formula.Formula;

                    #region Formula
                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        strExpression = strExpression.Replace("{" + strProperty + "}", "[" + strProperty + "]");
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        strExpression = strExpression.Replace("{" + strVariableName + "}", "[" + strVariableName + "]");
                    }


                    Expression e = new Expression(strExpression);
                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        if (strExpression.Contains("[" + strProperty + "]"))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strProperty);
                            if (objValue == null)
                            {
                                continue;
                            }

                            double dbValue = 0;
                            Double.TryParse(objValue.ToString(), out dbValue);
                            e.Parameters[strProperty] = dbValue;
                        }
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        if (strExpression.Contains("[" + strVariableName + "]"))
                        {
                            e.Parameters[strVariableName] = lstVariables[strVariableName];
                        }
                    }

                    #endregion

                    objAmt = e.Evaluate();
                }
                else if (formula.IsUseSumFromChild)
                {
                    objAmt = 0;
                    if (lstObjecItems.ContainsKey(formula.SumChildTableName) && DataStructureProvider.IsTableColumn(formula.SumChildTableName, formula.SumChildFieldName))
                    {
                        objAmt = lstObjecItems[formula.SumChildTableName].Sum(t => Convert.ToDouble(ABCDynamicInvoker.GetValue((BusinessObject)t, formula.SumChildFieldName)));
                    }
                }

                if (formula.IsVariable && lstVariables.ContainsKey(formula.FormulaName) == false)
                {
                    lstVariables.Add(formula.FormulaName, Math.Round(Convert.ToDouble(objAmt), 3));
                }

                bool isCalculatedWithCurrentFormula = false;
                if (!formula.IsVariable && DataStructureProvider.IsTableColumn(obj.AATableName, formula.FormulaName))
                {
                    if (objAmt != null)
                    {
                        if (objAmt is double)
                        {
                            objAmt = Math.Round(Convert.ToDouble(objAmt), 3);
                        }

                        if (ABCDynamicInvoker.GetValue(obj, formula.FormulaName).ToString() != objAmt.ToString())
                        {
                            ABCDynamicInvoker.SetValue(obj, formula.FormulaName, objAmt);
                            isCalculatedWithCurrentFormula = true;
                        }
                    }
                }


                if (voucher != null && formula.IsCustomByCode)
                {
                    isCalculatedWithCurrentFormula = voucher.CustomFormulaCalc(obj, lstObjecItems, formula);
                }

                isCalculated = isCalculated | isCalculatedWithCurrentFormula;

                if (isCalculatedWithCurrentFormula && !string.IsNullOrWhiteSpace(formula.FieldRelations))
                {
                    foreach (String strRelation in formula.FieldRelations.Split(';').ToList())
                    {
                        if (FormulasList[obj.AATableName].Values.Count(t => t.FormulaName == strRelation) > 0)
                        {
                            int?iIndex = FormulasList[obj.AATableName].Values.Where(t => t.FormulaName == strRelation).Select(t => t.CalcIndex).First();
                            if (!iIndex.HasValue)
                            {
                                continue;
                            }

                            if (FormulasList[obj.AATableName].Values.Count(t => t.CalcIndex == iIndex.Value - 1) > 0)
                            {
                                iIndex = FormulasList[obj.AATableName].Values.Where(t => t.CalcIndex == iIndex.Value - 1).Select(t => t.CalcIndex).First();
                                if (!iIndex.HasValue)
                                {
                                    continue;
                                }

                                CalculateMainOnly(voucher, obj, lstObjecItems, strRelation, isSave);
                            }
                        }
                    }
                }
            }

            if (isCalculated && obj.GetID() != null && isSave)
            {
                BusinessControllerFactory.GetBusinessController(obj.AATableName).UpdateObject(obj);

                if (!CalculateQueue.ContainsKey(obj.AATableName))
                {
                    CalculateQueue.Add(obj.AATableName, new List <Guid>());
                }

                if (!CalculateQueue[obj.AATableName].Contains(obj.GetID()))
                {
                    CalculateQueue[obj.AATableName].Add(obj.GetID());

                    if (DataStructureProvider.DataTablesList.ContainsKey(obj.AATableName))
                    {
                        foreach (String strFkCol in DataStructureProvider.DataTablesList[obj.AATableName].ForeignColumnsList.Keys)
                        {
                            Guid fkID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strFkCol));
                            if (fkID == Guid.Empty)
                            {
                                continue;
                            }

                            BusinessObjectController FKCtrl = BusinessControllerFactory.GetBusinessController(DataStructureProvider.GetTableNameOfForeignKey(obj.AATableName, strFkCol));
                            if (FKCtrl != null)
                            {
                                BusinessObject fkObj = FKCtrl.GetObjectByID(fkID);
                                if (fkObj != null)
                                {
                                    Calculate(fkObj, true);
                                }
                            }
                        }
                    }

                    if (!CalculateQueue.ContainsKey(obj.AATableName))
                    {
                        CalculateQueue.Add(obj.AATableName, new List <Guid>());
                    }

                    if (!CalculateQueue[obj.AATableName].Contains(obj.GetID()))
                    {
                        CalculateQueue[obj.AATableName].Remove(obj.GetID());
                    }
                }
            }

            return(isCalculated);
        }
Exemplo n.º 14
0
        public static ABCBaseScreen GetABCScreen(STViewsInfo info, ViewMode mode)
        {
            if (info.STViewID == null || info.STViewID == Guid.Empty)
            {
                return(null);
            }

            info = (STViewsInfo) new STViewsController().GetObjectByID(info.STViewID);
            if (info == null)
            {
                return(null);
            }


            if (ABCScreenManager.Instance.CheckViewPermission(info.STViewID, ViewPermission.AllowView) == false)
            {
                ABCHelper.ABCMessageBox.Show("Bạn không đủ quyền hạn sử dụng tính năng này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            ABCBaseScreen screen = null;

            #region Get Type
            Type type = GetABCScreenType(info.STViewID);
            if (type == null)
            {
                if (info.STViewUseCode && String.IsNullOrWhiteSpace(info.STViewCode) == false)
                {
                    Assembly ass = ABCScreenFactory.CompileScreenSouceCode(info);
                    if (ass != null)
                    {
                        if (!String.IsNullOrWhiteSpace(info.ScreenName))
                        {
                            type = ass.GetType("ABCApp.Screens." + info.ScreenName + "Screen");
                        }

                        if (type == null && !String.IsNullOrWhiteSpace(info.STViewNo))
                        {
                            type = ass.GetType("ABCApp.Screens." + info.STViewNo + "Screen");
                        }

                        if (type != null)
                        {
                            screen = (ABCBaseScreen)ass.CreateInstance(type.FullName);
                        }
                        //   screen=(ABCBaseScreen)AppDomain.CurrentDomain.CreateInstanceAndUnwrap( type.Assembly.FullName ,type.FullName );
                        if (screen != null)
                        {
                            screen.LoadScreen(info, mode);
                            return(screen);
                        }
                    }
                }
            }

            if (type == null)
            {
                type = typeof(ABCBaseScreen);
            }
            #endregion

            if (type != null)
            {
                screen = (ABCBaseScreen)ABCDynamicInvoker.CreateInstanceObject(type);
            }

            if (screen != null)
            {
                screen.LoadScreen(info, mode);
            }

            return(screen);
        }
Exemplo n.º 15
0
        public static Component LoadComponent(ABCView ViewOwner, XmlNode node)
        {
            String strName = node.Attributes["name"].Value.ToString();
            String strType = node.Attributes["type"].Value.ToString();
            Type   type    = TypeResolutionService.CurrentService.GetType(strType);

            if (type == null)
            {
                return(null);
            }

            #region Node
            Component comp = null;

            #region ABCView
            if (type == typeof(ABCView))
            {
                if (node.Attributes["isRoot"] != null && node.Attributes["isRoot"].Value.ToString() == "true")
                {
                    #region root
                    DeSerialization(ViewOwner, node);

                    ViewOwner.IsRoot = true;
                    ViewOwner.Name   = node.Attributes["name"].Value.ToString();
                    if (String.IsNullOrWhiteSpace(ViewOwner.Caption))
                    {
                        ViewOwner.Caption = ViewOwner.Name;
                    }

                    comp = ViewOwner;

                    LoadChildrenComponent(ViewOwner, node, comp);

                    #endregion
                }
                else
                {
                    #region Included ABCView
                    if (ViewOwner.Mode == ViewMode.Design)
                    {
                        comp = (Component)ViewOwner.Surface.DesignerHost.CreateComponent(type);
                    }
                    else
                    {
                        comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);
                    }

                    DeSerialization(comp, node);

                    ((ABCView)comp).IsRoot = false;

                    Guid        iID      = ABCHelper.DataConverter.ConvertToGuid(node.Attributes["ID"].Value);
                    STViewsInfo viewInfo = (STViewsInfo) new STViewsController().GetObjectByID(iID);
                    if (viewInfo != null)
                    {
                        ((ABCView)comp).DataField = viewInfo;
                        ViewOwner.ChildrenView.Add((ABCView)comp);
                    }

                    #endregion
                }

                ((IABCControl)comp).OwnerView = ViewOwner;
                ((IABCControl)comp).InitControl();

                return(comp);
            }
            #endregion

            #region ABCDockPanel
            if (type == typeof(DevExpress.XtraBars.Docking.DockPanel) || type == typeof(ABCControls.ABCDockPanel))
            {
                comp = (Component)ABCDockPanel.AddNewDockPanel(ViewOwner);
                DeSerialization(comp, node);
                ((ABCDockPanel)comp).InitLayout(ViewOwner, node);
                return(comp);
            }
            #endregion

            comp = CreateComponent(ViewOwner, type);
            if (comp is Control)
            {
                (comp as Control).SuspendLayout();
            }

            if (comp is IABCControl)
            {
                ((IABCControl)comp).OwnerView = ViewOwner;
                ((IABCControl)comp).InitControl();
            }

            DeSerialization(comp, node);

            if (comp is IABCCustomControl)
            {
                ((IABCCustomControl)comp).InitLayout(ViewOwner, node);
            }
            else
            {
                LoadChildrenComponent(ViewOwner, node, comp);
            }

            #endregion

            if (comp is Control)
            {
                (comp as Control).ResumeLayout(false);
            }

            if (comp is ABCSimpleButton)
            {
                ViewOwner.ButtonList.Add(comp as ABCSimpleButton);
            }
            if (comp is ABCComment)
            {
                ViewOwner.CommentList.Add(comp as ABCComment);
            }

            return(comp);
        }
Exemplo n.º 16
0
        public static String GenerateNo(BusinessObject obj)
        {
            if (obj.GetID() == Guid.Empty)
            {
                obj.SetNoValue(String.Empty);
                return(String.Empty);
            }

            String strNoValue = String.Empty;

            Numbering numbering = GetNumberingConfig(obj);

            if (numbering != null)
            {
                if (!numbering.IsUsePattern)
                {
                    #region Not UsePattern
                    if (numbering.MiddleConfigs.Count > 0)
                    {
                        #region Have Parts
                        List <String> lstParts = new List <string>();
                        foreach (NumberingType numberType in numbering.MiddleConfigs)
                        {
                            #region Others
                            if (numberType.IsByUser)
                            {
                            }
                            if (numberType.IsByUserGroup)
                            {
                            }
                            if (numberType.IsByEmployee)
                            {
                            }
                            if (numberType.IsByCompanyUnit)
                            {
                            }
                            #endregion

                            if ((numberType.IsYYMMCount || numberType.IsYYMMDDCount || numberType.IsMMDDCount))
                            {
                                String strDateCol = String.Empty;
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                                {
                                    strDateCol = ABCCommon.ABCConstString.colCreateTime;
                                }
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                                {
                                    strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                                }

                                if (!String.IsNullOrWhiteSpace(strDateCol))
                                {
                                    object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                                    if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                                    {
                                        #region With DateTime
                                        DateTime createTime = DateTime.MinValue;
                                        if (objValue is Nullable <DateTime> )
                                        {
                                            createTime = (objValue as Nullable <DateTime>).Value;
                                        }
                                        else
                                        {
                                            createTime = Convert.ToDateTime(objValue);
                                        }

                                        if (numberType.IsYYMMCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;


                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        if (numberType.IsYYMMDDCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND DAY({0}) = {3} AND {0} < {4}", strDateCol, createTime.Year, createTime.Month, createTime.Day, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;

                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("yyMMdd") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        if (numberType.IsMMDDCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND DAY({0}) = {3} AND {0} < {4}", strDateCol, createTime.Year, createTime.Month, createTime.Day, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;

                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("MMdd") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        #endregion
                                    }
                                }
                            }

                            #region By Field
                            if (numberType.IsByField && !String.IsNullOrWhiteSpace(numberType.FieldName))
                            {
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, numberType.FieldName))
                                {
                                    object objValue = ABCDynamicInvoker.GetValue(obj, numberType.FieldName);
                                    if (objValue != null)
                                    {
                                        if (DataStructureProvider.IsForeignKey(obj.AATableName, numberType.FieldName))
                                        {
                                            String strFieldName = numberType.FieldName + ":" + DataStructureProvider.GetDisplayColumn(obj.AATableName);
                                            objValue = DataCachingProvider.GetCachingObjectAccrossTable(obj, ABCHelper.DataConverter.ConvertToGuid(objValue), strFieldName);
                                        }

                                        lstParts.Add(objValue.ToString());
                                    }
                                }
                            }
                            #endregion
                        }

                        strNoValue = numbering.Prefix + String.Join(numbering.SeperateChar, lstParts) + numbering.Suffix;

                        #endregion
                    }
                    else
                    {
                        String strDateCol = String.Empty;
                        if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                        {
                            strDateCol = ABCCommon.ABCConstString.colCreateTime;
                        }
                        if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                        {
                            strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                        }

                        if (!String.IsNullOrWhiteSpace(strDateCol))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                            if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                            {
                                #region With DateTime
                                DateTime createTime = DateTime.MinValue;
                                if (objValue is Nullable <DateTime> )
                                {
                                    createTime = (objValue as Nullable <DateTime>).Value;
                                }
                                else
                                {
                                    createTime = Convert.ToDateTime(objValue);
                                }

                                String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                                int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                if (iCount <= 0)
                                {
                                    iCount = 0;
                                }
                                iCount++;

                                int iCountSpace = 3;
                                if (iCountSpace < iCount.ToString().Length)
                                {
                                    iCountSpace = iCount.ToString().Length + 2;
                                }

                                strNoValue = numbering.Prefix + createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount) + numbering.Suffix;

                                #endregion
                            }
                        }
                        else if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colNoIndex))
                        {
                            int iNoIndex    = Convert.ToInt32(ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colNoIndex));
                            int iCountSpace = 4;
                            if (iNoIndex >= 10000)
                            {
                                iCountSpace = iNoIndex.ToString().Length + 2;
                            }
                            strNoValue = numbering.Prefix + String.Format("{0:D" + iCountSpace + "}", iNoIndex) + numbering.Suffix;
                        }
                    }
                    #endregion
                }
                else
                {
                    #region UsePattern

                    #endregion
                }
            }
            else
            {
                #region Have No Config
                if (!String.IsNullOrWhiteSpace(DataConfigProvider.TableConfigList[obj.AATableName].PrefixNo))
                {
                    strNoValue = DataConfigProvider.TableConfigList[obj.AATableName].PrefixNo;
                }
                else
                {
                    strNoValue = new Regex("[^A-Z]+").Replace(DataConfigProvider.GetTableCaption(obj.AATableName), "");
                }


                String strDateCol = String.Empty;
                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                {
                    strDateCol = ABCCommon.ABCConstString.colCreateTime;
                }
                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                {
                    strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                }

                if (!String.IsNullOrWhiteSpace(strDateCol))
                {
                    object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                    if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                    {
                        #region With DateTime
                        DateTime createTime = DateTime.MinValue;
                        if (objValue is Nullable <DateTime> )
                        {
                            createTime = (objValue as Nullable <DateTime>).Value;
                        }
                        else
                        {
                            createTime = Convert.ToDateTime(objValue);
                        }

                        String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                        strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                        int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                        if (iCount <= 0)
                        {
                            iCount = 0;
                        }
                        iCount++;

                        int iCountSpace = 3;
                        if (iCountSpace < iCount.ToString().Length)
                        {
                            iCountSpace = iCount.ToString().Length + 2;
                        }

                        strNoValue += createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount);

                        #endregion
                    }
                }
                else if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colNoIndex))
                {
                    int iNoIndex    = Convert.ToInt32(ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colNoIndex));
                    int iCountSpace = 4;
                    if (iNoIndex >= 10000)
                    {
                        iCountSpace = iNoIndex.ToString().Length + 2;
                    }
                    strNoValue += String.Format("{0:D" + iCountSpace + "}", iNoIndex);
                }

                #endregion
            }

            obj.SetNoValue(strNoValue);
            return(strNoValue);
        }
Exemplo n.º 17
0
        public static void DoInventoryAction(List <BusinessObject> lstObjects, bool isCalcInventoryReport)
        {
            #region Init
            Dictionary <String, List <BusinessObject> > lstDictObjects = new Dictionary <string, List <BusinessObject> >();
            foreach (BusinessObject obj in lstObjects)
            {
                if (lstDictObjects.ContainsKey(obj.AATableName) == false)
                {
                    lstDictObjects.Add(obj.AATableName, new List <BusinessObject>()
                    {
                        obj
                    });
                }
                else
                {
                    lstDictObjects[obj.AATableName].Add(obj);
                }
            }
            #endregion

            Dictionary <Guid, List <Guid> > lstProductIDs = new Dictionary <Guid, List <Guid> >();

            CriteriaToExpressionConverter converter = new CriteriaToExpressionConverter();
            foreach (String strTableName in lstDictObjects.Keys)
            {
                if (IsNeedCalculateInventory(strTableName))
                {
                    #region Calculate Inventory

                    foreach (ICInventoryConfigsInfo config in GetConfigs(strTableName))
                    {
                        if (!config.IsShipment || !config.IsLost || !config.IsReceive)
                        {
                            continue;
                        }

                        DevExpress.Data.Filtering.CriteriaOperator operatorConvert = DevExpress.Data.Filtering.CriteriaOperator.Parse(config.VoucherConditionString);
                        List <BusinessObject> lstFilteredObjects = ((IQueryable <BusinessObject>)lstDictObjects[strTableName].AsQueryable().AppendWhere(converter, operatorConvert)).ToList();
                        foreach (BusinessObject obj in lstFilteredObjects)
                        {
                            #region companyUnitID

                            Guid companyUnitID = Guid.Empty;
                            if (!String.IsNullOrWhiteSpace(config.VoucherComUnitIDField))
                            {
                                companyUnitID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, config.VoucherComUnitIDField));
                            }
                            else if (!String.IsNullOrWhiteSpace(config.VoucherRealComUnitIDField) && !String.IsNullOrWhiteSpace(config.VoucherTableName))
                            {
                                companyUnitID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, config.VoucherRealComUnitIDField));
                                companyUnitID = CompanyUnitProvider.GetCompanyUnitID(config.VoucherTableName, companyUnitID);
                            }
                            if (companyUnitID == Guid.Empty)
                            {
                                continue;
                            }
                            #endregion

                            Guid     productID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, config.ProductIDField));
                            String   strSKU    = ABCDynamicInvoker.GetValue(obj, config.SKUField).ToString();
                            double   qty       = Convert.ToDouble(ABCDynamicInvoker.GetValue(obj, config.QtyField));
                            DateTime date      = Convert.ToDateTime(ABCDynamicInvoker.GetValue(obj, config.DateField));

                            if (productID != Guid.Empty && qty != 0 && date != null && date != DateTime.MinValue && date != DateTime.MaxValue)
                            {
                                if (config.IsShipment || config.IsLost)
                                {
                                    DoShipment(companyUnitID, productID, strSKU, qty, date);
                                }
                                else if (config.IsReceive)
                                {
                                    DoReceipt(companyUnitID, productID, strSKU, qty, date);
                                }

                                if (lstProductIDs.ContainsKey(companyUnitID) == false)
                                {
                                    lstProductIDs.Add(companyUnitID, new List <Guid>()
                                    {
                                        productID
                                    });
                                }
                                else
                                {
                                    lstProductIDs[companyUnitID].Add(productID);
                                }
                            }
                        }
                    }
                    #endregion
                }
            }

            if (isCalcInventoryReport)
            {
                //foreach ( Guid comUnitID in lstProductIDs.Keys )
                //{
                //    foreach(Guid productID in lstProductIDs[comUnitID])
                //        InventoryReportCalculate(comUnitID,productID,
                //}
            }
        }
Exemplo n.º 18
0
        public void InitLayout(ABCView view, XmlNode node)
        {
            OwnerView = view;

            XmlNode child = node.SelectNodes("C")[0];

            if (child == null)
            {
                return;
            }

            String strType = child.Attributes["type"].Value.ToString();

            String strChildType = child.Attributes["type"].Value.ToString();
            Type   type         = TypeResolutionService.CurrentService.GetType(strChildType);

            if (type == null)
            {
                return;
            }

            Component comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);

            ABCPresentHelper.DeSerialization(comp, child);
            ((IABCControl)comp).OwnerView = view;
            ((IABCControl)comp).InitControl();
            (comp as Control).Parent = this;
            this.EditControl         = (IABCBindableControl)comp;

            if (view.Mode != ViewMode.Design && comp is ABCGridLookUpEdit)
            {
                if (((ABCGridLookUpEdit)comp).Properties.View.Columns.Count <= 2)
                {
                    Component comp2 = (Component)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCLookUpEdit));
                    ((IABCBindableControl)comp2).DataSource = this.DataSource;
                    ((IABCBindableControl)comp2).DataMember = this.DataMember;
                    ((IABCBindableControl)comp2).TableName  = this.TableName;

                    ((IABCControl)comp2).OwnerView = view;
                    ((IABCControl)comp2).InitControl();
                    (comp2 as Control).Parent = this;
                    this.EditControl          = (IABCBindableControl)comp2;
                }
            }

            InvalidateControl();

            if (this.OwnerView == null || (this.OwnerView != null && this.OwnerView.Mode != ViewMode.Design))
            {
                bool   isUse      = true;
                String strRealCol = this.DataMember.Split(':')[0];
                if (!DataStructureProvider.IsTableColumn(this.TableName, strRealCol))
                {
                    isUse = false;
                }

                else if (!DataConfigProvider.TableConfigList.ContainsKey(this.TableName) || !DataConfigProvider.TableConfigList[this.TableName].FieldConfigList.ContainsKey(strRealCol))
                {
                    isUse = false;
                }

                else if (!DataConfigProvider.TableConfigList[this.TableName].FieldConfigList[strRealCol].InUse)
                {
                    isUse = false;
                }

                if (!isUse)
                {
                    this.Visible = false;
                }
            }
        }