Exemplo n.º 1
0
 public void Dispose()
 {
     _shareLinkSubscription.Dispose();
     ShareCommand.Dispose();
     Text.Dispose();
     KeyPressedCommand.Dispose();
     SelectAllTextTrigger.Dispose();
     IsInProgress.Dispose();
     ErrorMessage.Dispose();
     _textToSpeechSubscription.Dispose();
 }
Exemplo n.º 2
0
		void ReleaseDesignerOutlets ()
		{
			if (EvalButton != null) {
				EvalButton.Dispose ();
				EvalButton = null;
			}

			if (ErrorMessage != null) {
				ErrorMessage.Dispose ();
				ErrorMessage = null;
			}
		}
Exemplo n.º 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         ErrorPanel?.Dispose();
         ErrorMessage?.Dispose();
         MainPanel?.Dispose();
         ServerName?.Dispose();
         MemoryAllocation?.Dispose();
         RadAjaxManager?.Dispose();
         CacheGrid?.Dispose();
     }
 }
Exemplo n.º 4
0
        public MaintenanceFacade()
        {
            ErrorMessage objErr = new ErrorMessage();

            try
            {
            }
            catch (Exception ex)
            {
                objErr.ErrorCode   = ErrorHandler.SRV_CONNECT_ERR;
                objErr.ErrorDesc   = ex.Message;
                objErr.ErrorSource = ex.Source;
                ErrorHandler.ThrowError(objErr);
            }
            finally
            {
                objErr.Dispose();
            }
        }
Exemplo n.º 5
0
        public void Process(ref Message msg)
        {
            ErrorMessage objErr = new ErrorMessage();

            dbManager = new DBManager();
            try
            {
                //var appSettingsSection = IConfiguration.GetSection("AppSettings");
                TransactionOptions transactionOptions = new TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                transactionOptions.Timeout        = new TimeSpan(10, 0, 0);

                using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
                {
                    try
                    {
                        dbManager.Open();

                        if (msg.ObjectName.ToUpper() == WB.SYSTEM.Constants.OBJ_MNT_ROLE_PERMISSION)
                        {
                        }
                        else if (msg.ObjectName.ToUpper() == WB.SYSTEM.Constants.OBJ_EXECUTESTOREPROCEDURE) //Kiem tra: Goi store hay sinh cau lenh sql
                        {
                            BusinessEntity ent = new BusinessEntity();
                            ent.dbManager = dbManager;

                            //List objects
                            ArrayList arrayLists = new ArrayList();

                            ArrayList arrObj    = msg.Body;
                            ArrayList arrDetail = new ArrayList();
                            ArrayList arrHeader = new ArrayList();
                            ArrayList arrData   = new ArrayList();

                            string strObjName = "";

                            for (int i = 0; i < arrObj.Count; i += 2)
                            {
                                strObjName = arrObj[i].ToString();
                                arrData    = (ArrayList)arrObj[i + 1];

                                //Exec foreach store
                                arrHeader = (ArrayList)arrData[0];
                                for (int j = 1; j < arrData.Count; j++)
                                {
                                    arrDetail = (ArrayList)arrData[i + 1];

                                    ent.arrProperties = SysUtils.Property2Value(arrDetail, arrHeader);
                                    ent.entityName    = strObjName;

                                    //Execute
                                    arrDetail = ent.ExecuteStoreProcedure(strObjName);

                                    if (ent.arrPK == null)
                                    {
                                        ent.arrPK = arrDetail;
                                    }

                                    //Reture
                                    arrayLists.Add(strObjName);
                                    arrayLists.Add(arrDetail);
                                }
                            }

                            msg.Body = arrayLists;
                        }
                        else  //Defaul: gen sql statement
                        {
                            BusinessEntity ent = new BusinessEntity();
                            ent.dbManager     = dbManager;
                            ent.arrProperties = msg.Body;
                            ent.entityName    = msg.ObjectName;

                            //CASE1: CALL PROCEDURE
                            if (msg.ObjectName.ToUpper().Substring(0, 3) == "SP_")
                            {
                                msg.Body = ent.ExecuteStoreProcedure(msg.ObjectName);
                            }
                            else
                            {
                                //CASE2: Auto gen SQL
                                //1.SAVE MASTER
                                if (msg.MsgAction == WB.SYSTEM.Constants.MSG_ADD_ACTION)
                                {
                                    ent.Add();
                                }
                                if (msg.MsgAction == WB.SYSTEM.Constants.MSG_UPDATE_ACTION)
                                {
                                    ent.Update();
                                }
                                if (msg.MsgAction == WB.SYSTEM.Constants.MSG_DELETE_ACTION)
                                {
                                    ent.Delete();
                                }

                                //SAVE PKey for Master to insert properties of Detail
                                ArrayList arrMasterPkey       = ent.arrPK;
                                ArrayList arrMasterProperties = ent.arrProperties;

                                //2.UPDATE DETAIL
                                //2.1LOAD ALL CTRLTYPE =GE -->Grid
                                ent.arrProperties = new ArrayList();
                                ent.arrProperties.Add("MODID");
                                ent.arrProperties.Add(msg.ModId);
                                ent.arrProperties.Add("CTRLTYPE");
                                ent.arrProperties.Add("GE");
                                ent.entityName = "DEFMODFLD";
                                ent.arrPK      = ent.arrProperties;
                                ArrayList arrDefModFld = ent.Fetch("");

                                ArrayList arrHeader = new ArrayList();
                                ArrayList arrDetail = new ArrayList();

                                //2.2 SAVE DETAIL
                                if (arrDefModFld.Count > 0)
                                {
                                    arrHeader = (ArrayList)arrDefModFld[0];
                                    arrDetail = new ArrayList();

                                    for (int i = 1; i < arrDefModFld.Count; i++)
                                    {
                                        arrDetail = (ArrayList)arrDefModFld[i];
                                        string entity = SysUtils.getProperty(arrHeader, arrDetail, "ENTITY");
                                        ent.entityName = entity;

                                        string fldName   = SysUtils.getProperty(arrHeader, arrDetail, "FLDNAME");
                                        string jsonValue = SysUtils.CString(SysUtils.getValue(msg.Body, fldName));
                                        if (string.IsNullOrEmpty(jsonValue))
                                        {
                                            break;
                                        }

                                        //2.2.1 Convert jsonValue to Table or List<Model>
                                        //JArray arrBody = JArray.Parse(jsonValue);
                                        var       table   = JsonConvert.DeserializeObject <DataTable>(jsonValue);
                                        ArrayList arrData = SysUtils.DataTable2ArrayList(table);

                                        if (msg.MsgAction == WB.SYSTEM.Constants.MSG_ADD_ACTION)
                                        {
                                            //2.2.2 Save
                                            for (int j = 1; j < arrData.Count; j++)
                                            {
                                                ent.arrProperties = SysUtils.Property2Value((ArrayList)arrData[j], (ArrayList)arrData[0]);
                                                ent.arrPK         = new ArrayList();

                                                //2.2.2.1 Update FKey from Pkey of Master
                                                for (int k = 0; k < arrMasterPkey.Count; k++)
                                                {
                                                    string strPkey = arrMasterPkey[k].ToString();
                                                    ent.setProperty(strPkey, SysUtils.getValue(arrMasterProperties, strPkey));
                                                }

                                                ent.Add();
                                            }
                                        }
                                        if (msg.MsgAction == WB.SYSTEM.Constants.MSG_UPDATE_ACTION)
                                        {
                                            //2.2.2.1 Delete by FKey
                                            ent.arrProperties = arrMasterProperties;
                                            ent.arrPK         = arrMasterPkey;
                                            ent.Delete();

                                            //2.2.2.2 Update
                                            for (int j = 1; j < arrData.Count; j++)
                                            {
                                                ent.arrProperties = SysUtils.Property2Value((ArrayList)arrData[0], (ArrayList)arrData[j]);
                                                //2.2.2.1 Update FKey from Pkey of Master
                                                for (int k = 0; k < arrMasterPkey.Count; k++)
                                                {
                                                    string strPkey = arrMasterPkey[k].ToString();
                                                    ent.setProperty(strPkey, ent.getProperty(strPkey));
                                                }

                                                ent.Update();
                                            }
                                        }
                                        if (msg.MsgAction == WB.SYSTEM.Constants.MSG_DELETE_ACTION)
                                        {
                                            //2.2.2.1 Delete by FKey
                                            ent.arrProperties = arrMasterProperties;
                                            ent.arrPK         = arrMasterPkey;
                                            ent.Delete();
                                        }
                                    }
                                }
                            }
                        }

                        msg.Body = new ArrayList();
                        ArrayList arrTemp = new ArrayList(); arrTemp.Add("Data"); msg.Body.Add(arrTemp);
                        arrTemp = new ArrayList(); arrTemp.Add("success"); msg.Body.Add(arrTemp);

                        transaction.Complete();
                    }
                    catch (Exception ex)
                    {
                        transaction.Dispose();
                        throw ex;
                    }
                }
            }
            catch (ErrorMessage ex)
            {
                ErrorHandler.ProcessErr(ex);
            }
            catch (Exception ex)
            {
                ErrorHandler.ProcessErr(ex, Constants.ERROR_TYPE_EBANK, ErrorHandler.EBANK_SYSTEM_ERROR);
            }
            finally
            {
                try
                {
                    dbManager.Close();
                    dbManager.Dispose();
                }
                catch
                {
                }
                objErr.Dispose();
            }
        }