protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             UserAcc ua = UserAcc.GetObjUser();
             hidUserID.Value        = ua.nUserID + "";
             hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             SetData(hidUserID.Value.toIntNullToZero());
             //txtOldPass.Attributes.Add("type", "password");
             //string strID = Request.QueryString["strid"];
             //if (!string.IsNullOrEmpty(strID))
             //{
             //    hidUserID.Value = STCrypt.Decrypt(strID);
             //    SetData(hidUserID.Value.toIntNullToZero());
             //    hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             //}
         }
     }
 }
        public void SendEmail_AcceptEditRequestByPTT(List <int> lstSubFacility, int nIndID, int nYear, int nQuarter, string sComment)
        {
            string sMsg = @"Dear All, <br />" +
                          "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Environmental Report has been accepted request edit by ptt as detailed below.<br />" +
                          "Facility : {0}<br />" +
                          "Group Indicator : {1}<br />" +
                          "Year : {2}<br />" +
                          "Quarter : {3}<br /><br />" +
                          "Comment : {4}<br /><br />" +
                          "Click <a href='{5}' target='_blank'>link</a> to view for further action.";
            var    dataFac    = db.mTFacility.Where(w => w.cDel == "N" && w.cActive == "Y" && w.nLevel == 2 && lstSubFacility.Contains(w.ID)).ToList();
            string strFacName = String.Join(", ", dataFac.Select(s => s.Name).OrderBy(o => o).ToList());
            var    dataInd    = db.mTIndicator.FirstOrDefault(w => w.ID == nIndID);

            string _sUrl      = sUrlWebSite + "AD/loginAD.aspx";
            string sFrom      = System.Configuration.ConfigurationSettings.AppSettings["SystemMail"] + "";
            var    dataToUser = (from d in db.mTWorkFlow.Where(w => w.IDIndicator == nIndID && lstSubFacility.Contains(w.IDFac))
                                 from u in db.mTUser.Where(w => w.cDel == "N" && w.cActive == "Y" && w.ID == d.L2)
                                 select new
            {
                u.Email
            }).GroupBy(g => g.Email).Select(s => s.Key).ToList();
            string strTo    = String.Join(",", dataToUser);
            string sMsgSend = string.Format(sMsg, strFacName, (dataInd != null ? dataInd.Indicator : ""), nYear, nQuarter, sComment, _sUrl);
            string sSubject = string.Format("Accepted request edit by ptt of {0} of quarter {1} {2} ", (dataInd != null ? dataInd.Indicator : ""), nQuarter, nYear); // 0 = Group Indicator,1=Quater,2=Year

            Workflow.DataMail_log Log = new Workflow.DataMail_log();
            Log = SystemFunction.SendMailAll(sFrom, strTo, "", "", sSubject, sMsgSend, "");
            new Workflow().SaveLogMail(Log);
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired() && SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         //var DataRole = UserAcc.GetRolePermission(UserAcc.GetObjUser().nUserID + "");
         //dvUSer.Visible = true;
         //if (DataRole.Count == 1)
         //{
         //    liChange.Visible = false;
         //    liChange2.Visible = false;
         //}
         string Url = SystemFunction.GetURL(Page.AppRelativeVirtualPath);
         if (SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
         {
             lrtMenu.Text         = SystemFunction.HTML_Menubar(Url);
             lrtNav_menu.Text     = SystemFunction.HTML_Navtab(Url);
             lrtNav_UserMenu.Text = SystemFunction.HTML_NavtabUser(Url);
         }
         else
         {
             dvUSer.Visible = false;
         }
         ltrFullName1.Text   = ltrFullName2.Text = UserAcc.GetObjUser().sFullName;
         ltrActionRole1.Text = ltrActionRole2.Text = UserAcc.GetObjUser().sActionRoleName;
     }
 }
    private void BindDDL()
    {
        SystemFunction.ListYearsDESC(ddlYear, "", "en-US", "th-TH", short.Parse(System.Configuration.ConfigurationSettings.AppSettings["startYear"].ToString()));
        SystemFunction.BindDropdownPageSize(ddlPageSize, null);

        ddlGroupIndicator.DataSource     = db.mTIndicator.OrderBy(o => o.nOrder).ToList();
        ddlGroupIndicator.DataValueField = "ID";
        ddlGroupIndicator.DataTextField  = "Indicator";
        ddlGroupIndicator.DataBind();
        ddlGroupIndicator.Items.Insert(0, new ListItem("- Select Indicator -", ""));

        int[] arrWFStatus = new int[] { 28, 29, 30, 32, 33, 34 };
        ddlStatus.DataSource     = db.TStatus_Workflow.Where(w => arrWFStatus.Contains(w.nStatustID) && w.cTypeUse == "TNF" && w.cActive == "Y").OrderBy(o => o.sShorttStatus).ToList();
        ddlStatus.DataValueField = "nStatustID";
        ddlStatus.DataTextField  = "sShorttStatus";
        ddlStatus.DataBind();
        ddlStatus.Items.Insert(0, new ListItem("- Select Status -", ""));
        ddlStatus.Items.Insert(1, new ListItem("Waiting Transfer", "0"));

        ddlFacility.DataSource = (from fptt in db.mTFacility.Where(w => w.cDel == "N" && w.cActive == "Y" && w.nLevel == 0 && w.CompanyID == 1)
                                  from fgc in db.mTFacility.Where(w => w.cDel == "N" && w.cActive == "Y" && w.nHeaderID == fptt.ID)
                                  select new
        {
            fgc.ID,
            fgc.Name
        }).OrderBy(o => o.Name).ToList();
        ddlFacility.DataTextField  = "Name";
        ddlFacility.DataValueField = "ID";
        ddlFacility.DataBind();
        ddlFacility.Items.Insert(0, new ListItem("- Select Facility -", ""));
    }
Esempio n. 5
0
 public string GetChildrenFunction(int _nParentId, SystemFunction[] _Functions)
 {
     StringBuilder sbJson = new StringBuilder();
     foreach (SystemFunction oFunction in _Functions)
     {
         if (oFunction.ParentId == _nParentId)
         {
             StringBuilder sbChildren = new StringBuilder();
             Hashtable ht = new Hashtable();
             ht["text"] = oFunction.Name;
             ht["value"] = oFunction.Id;
             sbChildren.Append(base.Json(ht, false));
             string strChildren = GetChildrenFunction(oFunction.Id, _Functions);
             if (!string.IsNullOrEmpty(strChildren))
             {
                 sbChildren.Append(base.JsonKeyValue("childrens", strChildren));
             }
             if (sbJson.Length >= 1)
             {
                 sbJson.Append(",");
             }
             sbJson.Append(base.JsonEnd(sbChildren.ToString()));
         }
     }
     return string.Format("[{0}]", sbJson.ToString());
 }
    private bool SetUserLogin(string sUserID, string sRoleID)
    {
        int nUserID = SystemFunction.ParseInt(sUserID);
        int nRoleID = SystemFunction.ParseInt(sRoleID);

        var dataUser = db.mTUser.FirstOrDefault(w => w.ID == nUserID);
        var dataRole = db.mTUserRole.FirstOrDefault(w => w.ID == nRoleID);

        var lst_RoleAdmin = db.TMenu_Permission.Where(w => w.nUserID == nUserID && w.nRoleID == nRoleID).ToList();          // Role_Admin
        var lst_RoleOther = db.mTUser_FacilityPermission.Where(w => w.nUserID == nUserID && w.nRoleID == nRoleID).ToList(); // Role_Other
        var lstDataRole   = db.mTUserRole.ToList();                                                                         // Query Role_Name

        if (dataUser != null && dataRole != null)
        {
            string  sNameRole = lstDataRole.Any() ? lstDataRole.First(w => w.ID == nRoleID).Name : "";
            UserAcc us        = new UserAcc();
            us.nUserID         = dataUser.ID;
            us.sFullName       = dataUser.Firstname + " " + dataUser.Lastname;
            us.nRoleID         = lst_RoleAdmin.Any() ? lst_RoleAdmin.First().nRoleID : lst_RoleOther.Any() ? lst_RoleOther.First().nRoleID : 0;
            us.sActionRoleName = sNameRole;
            UserAcc.SetObjUser(us);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 7
0
    void CollectIconSate(Action <int> action)
    {
        switch (this.BuildingLogicData.BuildingIdentity.buildingType)
        {
        case BuildingType.GoldMine:
            m_ResourceIcon.spriteId = m_ResourceIcon.GetSpriteIdByName(ClientSystemConstants.SCENE_RESOURCE_ICON_DICTIONARY[ResourceType.Gold]);
            if (this.BuildingLogicData.CurrentBuilidngState != BuildingEditorState.Normal || this.BuildingBehavior.IsClick)
            {
                action.Invoke(0);
            }
            else
            {
                action.Invoke(SystemFunction.CheckCollectValidity(this.BuildingLogicData, ResourceType.Gold));
            }
            break;

        case BuildingType.Farm:
            m_ResourceIcon.spriteId = m_ResourceIcon.GetSpriteIdByName(ClientSystemConstants.SCENE_RESOURCE_ICON_DICTIONARY[ResourceType.Food]);
            if (this.BuildingLogicData.CurrentBuilidngState != BuildingEditorState.Normal || this.BuildingBehavior.IsClick)
            {
                action.Invoke(0);
            }
            else
            {
                action.Invoke(SystemFunction.CheckCollectValidity(this.BuildingLogicData, ResourceType.Food));
            }
            break;
        }
        //if (this.BuildingLogicData.BuildingType == BuildingType.Farm)
        //{
        //    print("name =" + this.BuildingLogicData.Name);
        //    print("prefabName = " + this.gameObject);
        //    print("BuildingLogicData.CurrentStoreFood =" + BuildingLogicData.CurrentStoreFood);
        //}
    }
Esempio n. 8
0
        public IList <SystemFunction> GetSystemFunctions(string functionID, string functionName,
                                                         string description, string pageUrl, string menuName, int toolbarNo, string toolbarName,
                                                         bool isDefault, string memo, int startRowIndex, int maximumRows, string orderBy)
        {
            IList <SystemFunction> systemFunctions = new List <SystemFunction>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_SYSTEM_FUNCTION_S";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, startRowIndex);
            db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, maximumRows);
            db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy(orderBy));
            db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    SystemFunction systemFunction = CreateModelObject(dataReader);

                    systemFunctions.Add(systemFunction);
                }
            }

            _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count"));

            return(systemFunctions);
        }
Esempio n. 9
0
        public IList <SystemFunction> GetSystemFunctions()
        {
            IList <SystemFunction> systemFunctions = new List <SystemFunction>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_SYSTEM_FUNCTION_S";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, 25);
            db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy("functionid"));
            db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    SystemFunction systemFunction = CreateModelObject(dataReader);

                    systemFunctions.Add(systemFunction);
                }
            }

            _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count"));

            return(systemFunctions);
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             string strID = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(strID))
             {
                 hdfEncryptCompanyID.Value = STCrypt.Decrypt(strID);
                 SetData(hdfEncryptCompanyID.Value.toIntNullToZero());
                 hdfEncryptCompanyID.Value = STCrypt.Encrypt(hdfEncryptCompanyID.Value);
             }
             else
             {
                 //CR. 06.02.2019 Sync from SAP
                 txtCode.Enabled        = false;
                 txtCompanyName.Enabled = false;
             }
         }
     }
 }
Esempio n. 11
0
    public ENVIClass_Result CloseWFAPI(ENVIClass_ENVI dataENVI)
    {
        ENVIClass_Result result = new ENVIClass_Result();

        if (new ENVIService().Login(dataENVI.Username, dataENVI.Password, "ALL"))
        {
            if (!string.IsNullOrEmpty(dataENVI.CompanyCode) && !string.IsNullOrEmpty(dataENVI.FacilityCode) && !string.IsNullOrEmpty(dataENVI.IndicatorCode) && dataENVI.Year > 0 && dataENVI.Quarter > 0)
            {
                API_ENVI.ENVIWorkFlow.ENVIWorkFlow API = new API_ENVI.ENVIWorkFlow.ENVIWorkFlow();
                result = API.Workflow_PTTApproveL4(dataENVI);
                SystemFunction.SaveXML_UpdateStatus(dataENVI);
                SystemFunction.SaveXML_EPIResult(result);
            }
            else
            {
                result.IsCompleted = false;
                result.Message     = "Invalid Required Parameter: CompanyCode, FacilityCode, IndicatorCode, Year, Quarter";
            }
        }
        else
        {
            result.IsCompleted = false;
            result.Message     = "Login Failed";
        }
        return(result);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);

                int nRole = UserAcc.GetObjUser().nRoleID;
                if (nRole == 3 || nRole == 4)
                {
                    hdfPrmsMenu.Value = "2";
                }
                else
                {
                    hdfPrmsMenu.Value = "0";
                }

                BindDDL();
            }
        }
    }
Esempio n. 13
0
        /// <summary>
        /// 充值
        /// </summary>
        public override void WalletDepositMoney()
        {
            if (string.IsNullOrEmpty(txtWal_No.Text))
            {
                //钱包账号为空,充值失败
                MessageBoxs.Show(Trans.SD, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0016, new object[] { SystemTableColumnEnums.EWM_Wallet.Name.Wal_No, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //待充值的钱包
            WalletInfoUIModel walletToDeposit = BLLCom.GetWalletByWalletNo(txtWal_No.Text);

            if (string.IsNullOrEmpty(walletToDeposit.Wal_ID) ||
                string.IsNullOrEmpty(walletToDeposit.Wal_No))
            {
                //没有获取到钱包,充值失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //钱包相关信息
                { RIAViewParamKey.WalletInfo.ToString(), walletToDeposit },
            };

            //跳转到[钱包充值]
            SystemFunction.ShowViewFromView(MsgParam.WALLET_DEPOSITMONEY, ViewClassFullNameConst.RIA_FrmWalletDepositMoney, true, PageDisplayMode.TabPage, paramViewParameters, null);
        }
Esempio n. 14
0
    protected virtual void Collect(BuildingIdentity id, ResourceType type, CollectMethod collectMethod = CollectMethod.Button)
    {
        if (SceneManager.Instance.SceneMode == SceneMode.SceneVisit || this.m_CurrentState != BuildingEditorState.Normal || !this.BuildingBehavior.CheckBuildingCreateStack())
        {
            return;
        }
        if (this.m_CurrentState == BuildingEditorState.Normal)
        {
            switch (collectMethod)
            {
            case CollectMethod.Building:
                if (SystemFunction.CheckCollectValidity(this.BuildingLogicData, type) > 0)
                {
                    SceneManager.Instance.CreateCollectFX(this.BuildingBehavior, type, LogicController.Instance.Collect(id, type), this.BuildingLogicData);
                }
                //this.CreateCollectFX(type, LogicController.Instance.Collect(id, type));
                break;

            case CollectMethod.Button:
                if (SystemFunction.CheckCollectValidityByButton(this.BuildingLogicData, type))
                {
                    SceneManager.Instance.CreateCollectFX(this.BuildingBehavior, type, LogicController.Instance.Collect(id, type), this.BuildingLogicData);
                }
                //this.CreateCollectFX(type, LogicController.Instance.Collect(id, type));
                break;
            }
        }
    }
Esempio n. 15
0
 /// <summary>
 /// 列表Grid_DoubleClickCell
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gdGrid_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
 {
     if (e.Cell.Column.Key == SystemTableColumnEnums.EWM_WalletTrans.Code.WalT_BillNo)
     {
         string billNo = e.Cell.Text;
         if (billNo.Length < 7)
         {
             return;
         }
         string no = billNo.Substring(4, 2);
         if (no == "RB")
         {
             Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
             {
                 //收款单
                 { ComViewParamKey.BillNo.ToString(), billNo },
             };
             //跳转到[收款单]
             SystemFunction.ShowViewFromView(MsgParam.RECEIPTBILL_MANAGER, ViewClassFullNameConst.FM_FrmReceiptBillManager, true, PageDisplayMode.TabPage, paramViewParameters, null);
         }
         else if (no == "PB")
         {
             Dictionary <string, object> parambillNoViewParameters = new Dictionary <string, object>
             {
                 //付款单
                 { ComViewParamKey.BillNo.ToString(), billNo },
             };
             //跳转到[付款单]
             SystemFunction.ShowViewFromView(MsgParam.PAYBILL_MANGER, ViewClassFullNameConst.FM_FrmPayBillManager, true, PageDisplayMode.TabPage, parambillNoViewParameters, null);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                GETDDL();

                int Prms = SystemFunction.GetPermissionMenu(36);
                //hdfPrmsMenu.Value = Prms + "";
                //bool isView = Prms == 1;
                //if (isView)
                //{
                //    DivCreate_Workflow.Visible = false;
                //    ckbAll.Visible = false;
                //    btnDel.Visible = false;
                //}
            }
        }
    }
    public static sysGlobalClass.CResutlWebMethod getOperationTypePTT(string sFacilityPTT_ID)
    {
        sysGlobalClass.CResutlWebMethod result = new sysGlobalClass.CResutlWebMethod();
        PTTGC_EPIEntities db = new PTTGC_EPIEntities();

        if (!UserAcc.UserExpired())
        {
            int nFacilityPTT_ID = SystemFunction.GetIntNullToZero(sFacilityPTT_ID);
            var item            = db.mTFacility.FirstOrDefault(w => w.ID == nFacilityPTT_ID);
            if (item != null)
            {
                result.Content = item.OperationTypeID + "";
                result.Status  = SystemFunction.process_Success;
            }
            else
            {
                result.Msg    = "Data operation type not found.";
                result.Status = SystemFunction.process_Failed;
            }
        }
        else
        {
            result.Status = SystemFunction.process_SessionExpired;
        }
        return(result);
    }
Esempio n. 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                int Prms = SystemFunction.GetPermissionMenu(34);
                hdfPrmsMenu.Value = Prms + "";
                IsView            = Prms == 1;
                if (IsView)
                {
                    ckbAll.Visible    = false;
                    btnDel.Visible    = false;
                    btnCreate.Visible = false;
                }

                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                BlindDDL();
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             PTTGC_EPIEntities db  = new PTTGC_EPIEntities();
             string            str = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(str))
             {
                 int nFacID = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                 hdfFacID.Value = str;
                 ltrCreate.Text = "<a class=\"btn btn-primary btn-sm btn-block\" href=\"admin_asset_update.aspx?strid=" + HttpUtility.UrlEncode(str) + "\"><i class=\"fa fa-plus\"></i>&nbsp;Create Sub-facility</a>";
                 var itemHeader = db.mTFacility.FirstOrDefault(w => w.ID == nFacID);
                 if (itemHeader != null)
                 {
                     var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == itemHeader.CompanyID);
                     ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> >  <a style='color:white' href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(STCrypt.Encrypt(itemCompany.ID + "")) + "'> " + itemCompany.Name + "</a> > " + itemHeader.Name;//กำหนด Header
                 }
             }
             SystemFunction.BindDropdownPageSize(ddlPageSize, null);
         }
     }
 }
Esempio n. 20
0
    public static TRetunrLoadData Get_Facility(string operationID)
    {
        //if (lst == null) lst = new List<string>();
        TRetunrLoadData   result = new TRetunrLoadData();
        PTTGC_EPIEntities db     = new PTTGC_EPIEntities();

        if (UserAcc.UserExpired())
        {
            result.Status = SystemFunction.process_SessionExpired;
        }
        else
        {
            int nRoleID = UserAcc.GetObjUser().nRoleID;
            int nUserID = UserAcc.GetObjUser().nUserID;

            List <sysGlobalClass.T_Facility> lstFacility = new List <sysGlobalClass.T_Facility>();
            if (!string.IsNullOrEmpty(operationID))
            {
                int nID = int.Parse(operationID);
                lstFacility = SystemFunction.Get_SubFacility(nID, nUserID, nRoleID);
            }
            result.lstData_Facility = lstFacility.Distinct().ToList();
        }
        return(result);
    }
Esempio n. 21
0
    public static sysGlobalClass.CResutlWebMethod ApproveWithEditContent(int FormID)
    {
        PTTGC_EPIEntities env = new PTTGC_EPIEntities();

        sysGlobalClass.CResutlWebMethod r = new sysGlobalClass.CResutlWebMethod();
        int nOperationType = 0;

        if (!UserAcc.UserExpired())
        {
            var gData = env.TEPI_Forms.FirstOrDefault(f => f.FormID == FormID);
            if (gData != null)
            {
                r.Msg    = SystemFunction.ReturnPath(gData.IDIndicator, gData.OperationTypeID, gData.FacilityID.ToString(), gData.sYear, "27");
                r.Status = SystemFunction.process_Success;
            }
            else
            {
                r.Msg    = "";
                r.Status = SystemFunction.process_Failed;
            }
        }
        else
        {
            r.Msg    = "";
            r.Status = SystemFunction.process_SessionExpired;
        }
        return(r);
    }
Esempio n. 22
0
    // Update is called once per frame
    void Update()
    {
        float elapsedTime = Time.realtimeSinceStartup - this.m_StartTime;

        if (elapsedTime >= this.m_WaitTotalSeconds)
        {
            this.m_StartTime        = Time.realtimeSinceStartup;
            this.m_WaitTotalSeconds = this.m_WaitCount > 1 ? this.m_LastWaitSeconds :
                                      CommonHelper.GetRandomNumber(this.m_SecondWaitMinSeconds, this.m_SecondWaitMaxSeconds + 1);
            this.m_RemainingTimeLable.text = SystemFunction.TimeSpanToString(this.m_WaitTotalSeconds);
            if (this.m_Progress != null)
            {
                this.m_Progress.sliderValue = 0;
            }
            this.m_WaitCount++;
        }
        else
        {
            this.m_RemainingTimeLable.text = SystemFunction.TimeSpanToString(Mathf.CeilToInt(this.m_WaitTotalSeconds - elapsedTime));
            if (this.m_Progress != null)
            {
                this.m_Progress.sliderValue = elapsedTime / this.m_WaitTotalSeconds;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!UserAcc.UserExpired())
        {
            if (!IsPostBack)
            {
                setCBL();
                string sQueryStrIndID = Request.QueryString["in"];
                if (!string.IsNullOrEmpty(sQueryStrIndID))
                {
                    hdfIndID.Value = STCrypt.Encrypt(sQueryStrIndID);

                    ((_MP_EPI_FORMS)this.Master).hdfPRMS      = SystemFunction.GetPermissionMenu(15) + "";
                    ((_MP_EPI_FORMS)this.Master).hdfCheckRole = UserAcc.GetObjUser().nRoleID + "";
                }
                else
                {
                    SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "Intensity_from.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
                }
            }
        }
        else
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
    }
Esempio n. 24
0
        private StatusCode DispatchControllerMethod(
            RequestContext context,
            MethodHandle methodHandle,
            IList <Variant> inputArguments,
            List <StatusCode> inputArgumentResults,
            List <Variant> outputArguments)
        {
            SystemFunction data = methodHandle.MethodData as SystemFunction;

            if (data != null)
            {
                this.currentData = "CALL " + data.Function + inputArguments[0].ToString();


                GenericEvent e = new GenericEvent(Server.FilterManager);
                e.Initialize(
                    null,
                    ObjectTypeIds.SystemEventType,
                    ParsedNodeId.Construct(0, "Jemima", DefaultNamespaceIndex),
                    "Jemima",
                    EventSeverity.Medium,
                    "A Jemima is CALL."
                    );
                //e.Set(e.ToPath(new QualifiedName("Jackey", DefaultNamespaceIndex)), currentData);
                ReportEvent(e.SourceNode, e);

                return(StatusCodes.Good);
            }

            return(StatusCodes.BadNotImplemented);
        }
Esempio n. 25
0
 public string GetUserFunction(int _nUserId)
 {
     SystemFunction tree = new SystemFunction();
     tree.RootNode = new TreeNode("系统功能", "");
     tree.IsDisplayRootNode = true;
     tree.InitNodes(new List<SystemFunction>(SystemFunction.GetUserFunctin(_nUserId)));
     return tree.RootNode.ToJSON();
 }
    private void SETDATA(string sID)
    {
        if (!string.IsNullOrEmpty(sID))
        {
            int nID = SystemFunction.GetIntNullToZero(sID);
            PTTGC_EPIEntities db  = new PTTGC_EPIEntities();
            DateTime          now = DateTime.Now;
            var Query             = db.TContactUs.FirstOrDefault(w => w.cDel == "N" && w.nContactID == nID);
            if (Query != null)
            {
                if (Query.cStatusAns == null)
                {
                    Query.cStatusAns = "1";
                    Query.dUpdate    = now;
                    db.SaveChanges();
                }
                if (Query.cStatusAns == "2")
                {
                    txtDesc.Text = Query.sAnswer;
                    txtDesc.Attributes.Add("disabled", "true");
                    DivFileContactUS.Visible = false;
                    // lbUrlFileAdmin.Text = Query.sAnsPath + Query.sAnsFile;
                    if (!string.IsNullOrEmpty(Query.sAnsFile))
                    {
                        lbUrlFileAdmin.Text = "<a class='btn btn-primary'href=" + Query.sAnsPath + Query.sAnsSysFile + " target='_blank'><i class='fa fa-search'></i>&nbsp;" + Query.sAnsFile + "</a>";
                    }
                    else
                    {
                        lbUrlFileAdmin.Text = "-";
                    }
                }
                else
                {
                    DivShowFileAdmin.Visible = false;
                }
                hidsStatus.Value = Query.cStatusAns;
                lbName.Text      = Query.sContactName;
                lbEmail.Text     = Query.sContactEmail;
                lbSubject.Text   = Query.sSubject;
                lbTel.Text       = Query.sContactTel;
                lbUserDes.Text   = Query.sDetail;
                lbAddDate.Text   = Query.dCreate.ToString();
                //lbUrlFileUser.Text = Query.sContactPath + Query.sContactFile;
                if (!string.IsNullOrEmpty(Query.sContactFile))
                {
                    lbUrlFileUser.Text = "<a class='btn btn-primary'href=" + Query.sContactPath + Query.sContactSysFile + " target='_blank'><i class='fa fa-search'></i>&nbsp;" + Query.sContactFile + "</a>";
                }
                else
                {
                    lbUrlFileUser.Text = "-";
                }

                lbStatus.Text = Query.cStatusAns == null ? "Wait" : Query.cStatusAns == "1" ? "Read" : "Success";
            }
        }
    }
Esempio n. 27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!UserAcc.UserExpired())
        {
            ((_MP_EPI_FORMS)this.Master).hdfPRMS      = SystemFunction.GetPermissionMenu(nMenu) + "";
            ((_MP_EPI_FORMS)this.Master).hdfCheckRole = UserAcc.GetObjUser().nRoleID + "";

            hdfsRoleID.Value = UserAcc.GetObjUser().nRoleID + "";
        }
    }
Esempio n. 28
0
    void OnUpradeAllWall()
    {
        if (SceneManager.Instance.SelectedAllWallList.Count > 1)
        {
            for (int i = 0; i < SceneManager.Instance.SelectedAllWallList.Count; i++)
            {
                if (!SceneManager.Instance.SelectedAllWallList[i].IsBuild || !SceneManager.Instance.SelectedAllWallList[i].EnableCreate)
                {
                    return;
                }
            }
            this.ResetBuildingArrow();
            UIManager.Instance.HidePopuBtnByCurrentSelect(false);
            List <WallBehavior> wallBehaviorList = SceneManager.Instance.SelectedAllWallList;
            //wallBehaviorList.Sort(delegate(WallBehavior a, WallBehavior b) { return a.BuildingLogicData.Level - b.BuildingLogicData.Level; });
            wallBehaviorList.Sort((WallBehavior a, WallBehavior b) => a.BuildingLogicData.Level - b.BuildingLogicData.Level);
            int upgradeCount = 0;
            int upgradeStep  = 0;
            int wallLowLevel = wallBehaviorList[0].BuildingLogicData.Level;
            for (int i = 0; i < wallBehaviorList.Count; i++)
            {
                if (wallBehaviorList[i].BuildingLogicData.Level == wallLowLevel &&
                    wallBehaviorList[i].BuildingLogicData.Level <= LogicController.Instance.CurrentCityHallLevel - wallBehaviorList[i].BuildingLogicData.UpgradeStep &&
                    LogicController.Instance.IdleBuilderNumber > 0 &&
                    SystemFunction.UpgradeCostBalance(wallBehaviorList[i].BuildingLogicData).Count == 0)
                {
                    SceneManager.Instance.CreateUpgradeFX(wallBehaviorList[i]);
                    LogicController.Instance.BuyUpgradeWall(wallBehaviorList[i].BuildingLogicData.BuildingIdentity.buildingNO);
                    //SceneManager.Instance.CreateFX(wallBehaviorList[i].BuildingBehavior.BuildingAnchor, FxType.Upgrade1x1, false);
                    wallBehaviorList[i].BuildingCommon.ConstructBuilding();
                    upgradeStep = wallBehaviorList[i].BuildingLogicData.UpgradeStep;
                    upgradeCount++;
                }
                else
                {
                    wallBehaviorList[i].SetCellVisible(false);
                    wallBehaviorList[i].SetArrowState(false);
                    wallBehaviorList[i].IsClick = false;
                    wallBehaviorList[i].OnActiveBuildingFX(false);
                }
            }
            if (upgradeCount > 0)
            {
                UIErrorMessage.Instance.ErrorMessage(string.Format(StringConstants.ERROR_MESSAGE[24], upgradeCount.ToString(), wallLowLevel.ToString(), (wallLowLevel + upgradeStep).ToString()), Color.white);
            }
            //UIErrorMessage.Instance.ErrorMessage(24, upgradeCount.ToString(), wallLowLevel.ToString(), (wallLowLevel + upgradeStep).ToString());
            else
            {
                UIErrorMessage.Instance.ErrorMessage(23);
            }

            SceneManager.Instance.ClearAllWallList();
        }
    }
Esempio n. 29
0
        public void TestSystemFunctions()
        {
            List <SystemFunction> sysFunctions = AppDb.GetSystemFunctions().ToList();

            if (sysFunctions.Any())
            {
                SystemFunction first = sysFunctions.First();

                SystemFunction response = AppDb.GetSystemFunction(first.Id);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!UserAcc.UserExpired())
            {
                PTTGC_EPIEntities db       = new PTTGC_EPIEntities();
                string            str      = Request.QueryString["strid"];
                string            strFacID = Request.QueryString["strFacID"];
                int  nFacilityID           = 0;
                bool IsNew = false;
                if (!string.IsNullOrEmpty(str))
                {
                    hdfReturnStr.Value += "&&strid=" + HttpUtility.UrlEncode(str);
                    int nComID = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                    hdfComType.Value = nComID == 1 ? "PTT" : "GC";
                    hdfComID.Value   = str;
                    var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == nComID && w.cDel == "N");
                    if (itemCompany != null)
                    {
                        if (!string.IsNullOrEmpty(strFacID))
                        {
                            IsNew               = false;
                            nFacilityID         = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(strFacID));
                            hdfFacilityID.Value = strFacID;
                            var itemFacility = db.mTFacility.FirstOrDefault(w => w.cDel == "N" && w.ID == nFacilityID);
                            if (itemFacility != null)
                            {
                                ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> > <a href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(str) + "' style='color:white'>" + itemCompany.Name + "</a> > " + itemFacility.Name + "  > Edit";//กำหนด Header กรณีเข้ามา EDIT
                            }
                        }
                        else
                        {
                            IsNew          = true;
                            ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> > <a href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(str) + "' style='color:white'>" + itemCompany.Name + "</a> > Facility  > Create";//กำหนด Header  กรณีเข้ามา ADD
                        }

                        hdfIsNew.Value = IsNew ? "C" : "E";
                    }
                    setDDL_Cbl(IsNew, nComID);
                    setData(nFacilityID);
                }
                if (string.IsNullOrEmpty(str) && string.IsNullOrEmpty(strFacID))
                {
                    SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "admin_company_lst.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
                }
            }
            else
            {
                SetBodyEventOnLoad(SystemFunction.PopupLogin());
            }
        }
    }
Esempio n. 31
0
    public static sysGlobalClass.CResutlWebMethod ForgetPassword(string sEmail, string sUsername)
    {
        PTTGC_EPIEntities db = new PTTGC_EPIEntities();

        sysGlobalClass.CResutlWebMethod result = new sysGlobalClass.CResutlWebMethod();
        sEmail    = sEmail.ToLower();
        sUsername = sUsername.ToLower();

        var lstUser = db.mTUser.Where(w => w.cActive == "Y" && w.cDel == "N" && w.Username.ToLower() == sUsername && w.Email.ToLower() == sEmail).ToList();

        if (lstUser.Any())
        {
            var Data = lstUser.First();

            string sTitle  = "";
            string sText   = "";
            string subject = "";
            string message = "";
            string sURL    = "";
            string sFoot   = "";// "Should you have any questions about RD&T work process.";

            // sURL = Applicationpath + "login_forget.aspx?str=" + SystemFunction.Encrypt_UrlEncrypt(nDocID + "");

            subject = "Password Confirmation | " + SystemFunction.SystemName + "";

            sText += "<p>Your password is " + STCrypt.Decrypt(Data.PasswordEncrypt) + "</p>";

            string From = SystemFunction.GetSystemMail;
            string To   = Data.Email;
            message = string.Format(GET_TemplateEmail(),
                                    "Dear " + Data.Firstname + ' ' + Data.Lastname,
                                    sText,
                                    sURL,
                                    sFoot,
                                    "",
                                    "");
            Workflow.DataMail_log log = new Workflow.DataMail_log();
            log           = SystemFunction.SendMailAll(From, To, "", "", subject, message, "");
            log.nDataID   = SystemFunction.GetIntNullToZero(Data.ID + "");
            log.sPageName = "login.aspx";
            new Workflow().SaveLogMail(log);
            if (log.bStatus)
            {
                result.Status = SystemFunction.process_Success;
            }
        }
        else
        {
            result.Status = SystemFunction.process_Failed;
            result.Msg    = "data not found user";
        }
        return(result);
    }
Esempio n. 32
0
        public bool Insert(SystemFunction systemfunction)
        {
            int autonumber = 0;
            SystemFunctionDAC systemfunctionComponent = new SystemFunctionDAC();
            bool endedSuccessfuly = systemfunctionComponent.InsertNewSystemFunction(ref autonumber, systemfunction.Name, systemfunction.IsActive, systemfunction.IsBackendFunction, Guid.NewGuid(), DateTime.Now);

            if (endedSuccessfuly)
            {
                systemfunction.SystemFunctionId = autonumber;
            }
            return(endedSuccessfuly);
        }
Esempio n. 33
0
 protected void btnSave_ServerClick(object sender, EventArgs e)
 {
     string strName = txt_Name.Value.Trim();
     string strKey = txt_Key.Value.Trim();
     SystemFunction oFunction = SystemFunction.Get(nId);
     if (null == oFunction)
     {
         oFunction = new SystemFunction();
         oFunction.ModuleId = nParentId == -1 ? -1 : SystemFunction.Get(nParentId).ModuleId;
         oFunction.ParentId = nParentId;
         oFunction.Level = nParentId == -1 ? 1 : (SystemFunction.Get(nParentId).Level + 1);
     }
     PageUtil.PageFillEntity<SystemFunction>(this, oFunction);
     bool bSuccess = SystemFunction.Save(oFunction) > 0;
     PageUtil.PageAlert(this.Page, bSuccess ? "保存成功!" : "保存失败!");
 }
Esempio n. 34
0
 private SystemFunction[] _GetSon(SystemFunction _parentFunction)
 {
     List<SystemFunction> ltSon = new List<SystemFunction>();
     foreach (SystemFunction son in AllFunctions)
     {
         if (son.ParentId == _parentFunction.Id)
         {
             ltSon.Add(son);
             ltSon.AddRange(_GetSon(son));
         }
     }
     return ltSon.ToArray();
 }
Esempio n. 35
0
        protected void btn_UpdateModule_Click(object sender, EventArgs e)
        {
            txt_UpdateResult.Value = "";
            string strConfigFullName = file_ModuleConfig.Value;
            if (string.IsNullOrEmpty(strConfigFullName))
            {
                _setMessage("请先选择模块配置文件!", true);
                return;
            }
            string strFileName = System.IO.Path.GetFileName(strConfigFullName);
            string strFileEx = strFileName.Substring(strFileName.IndexOf("."));
            if (strFileEx != ".cfg.xml")
            {
                _setMessage("请上传文件后缀名称为“.cfg.xml”的配置文件!", true);
                return;
            }

            string strUploadPath = string.Format("{0}\\{1}", Server.MapPath(SystemUtil.GetVirtualSysUploadPath()), strFileName);
            try
            {
                file_ModuleConfig.PostedFile.SaveAs(strUploadPath);
                _setMessage("上传配置文件成功!", true);
            }
            catch (Exception ee)
            {
                _setMessage("上传配置文件失败!", true);
                _setMessage("程序终止!", true);
                return;
            }

            XmlDocument xmlModuleConfig = new XmlDocument();
            try
            {
                xmlModuleConfig.Load(strUploadPath);
                _setMessage("读取配置文件成功!", true);
            }
            catch (Exception ee)
            {
                _setMessage("读取配置文件失败!", true);
                _setMessage("程序终止!", true);
                return;
            }
            //模块配置文件有效性验证
            if (!_vModuleConfig(xmlModuleConfig))
                return;

            XmlNode moduleNode = xmlModuleConfig.SelectSingleNode("Module");
            //if (!_vModuleNode(moduleNode))
            //    return;
            Hashtable htFns = new Hashtable(); //该模块下的所有功能

            //配置模块基本信息
            string strModuleKey = _GetChildNodeText(moduleNode, "Key");
            SystemModule oModuleExist = SystemModule.Get(strModuleKey);
            bool bModuleAdd = null == oModuleExist;
            if (bModuleAdd)
            {
                oModuleExist = new SystemModule();
                oModuleExist.Key = strModuleKey;
            }
            oModuleExist.Name = _GetChildNodeText(moduleNode, "Name");
            oModuleExist.Description = _GetChildNodeText(moduleNode, "Description");
            oModuleExist.Controller = _GetChildNodeText(moduleNode, "Controller");
            oModuleExist.IconName = _GetChildNodeText(moduleNode, "IconName");
            oModuleExist.OrderId = TypeUtil.ParseInt(_GetChildNodeText(moduleNode, "OrderId"), 1);

            int nModuleId = SystemModule.Save(oModuleExist);
            _setMessage("模块信息保存" + (nModuleId <= 0 ? "失败!" : "成功!"), true);
            if(nModuleId <= 0)
                return;

            //检测模块功能根节点是否自动新增
            SystemFunction rootFn = SystemFunction.Get(strModuleKey);
            if (null == rootFn)
            {
                _setMessage(string.Format("模块根节点不存在!"), true);
                return;
            }

            //配置模块功能信息
            XmlNodeList nlFnsRoot = moduleNode.SelectNodes("Functions/Function");
            foreach (XmlNode nodeRootFn in nlFnsRoot)
            {
                //if (!_vFnNode(nodeRootFn))
                //    return;
                string strFnKey = _GetChildNodeText(nodeRootFn, "Key");
                SystemFunction oFnExist = SystemFunction.Get(strFnKey);
                bool bFnAdd = null == oFnExist;
                if (bFnAdd)
                {
                    oFnExist = new SystemFunction();
                    oFnExist.Key = strFnKey;
                    oFnExist.Level = 2;
                }
                oFnExist.ParentId = rootFn.Id;
                oFnExist.ModuleId = nModuleId;
                oFnExist.Name = _GetChildNodeText(nodeRootFn, "Name");
                oFnExist.Description = _GetChildNodeText(nodeRootFn, "Description");
                oFnExist.IconName = _GetChildNodeText(nodeRootFn, "IconName");
                oFnExist.OrderId = TypeUtil.ParseInt(_GetChildNodeText(nodeRootFn, "OrderId"), 1);
                int nFnId = SystemFunction.Save(oFnExist);
                if (nFnId <= 0)
                {
                    _setMessage(string.Format("功能“{0}”信息保存失败!", oFnExist.Name), true);
                    continue;
                }
                _setMessage(string.Format("功能“{0}”信息保存成功!", oFnExist.Name), true);
                if (!bModuleAdd)
                {
                    htFns[strFnKey] = 1;
                }
                //功能Action信息保存
                Hashtable htActions = new Hashtable();
                XmlNodeList nlActions = nodeRootFn.SelectNodes("Actions/Action");
                foreach (XmlNode nodeAction in nlActions)
                {
                    //if (!_vActionNode(nodeAction))
                    //    return;
                    string strActionKey = _GetChildNodeText(nodeAction, "Key");
                    SystemAction oActionExist = SystemAction.Get(strActionKey);
                    bool bActionAdd = null == oActionExist;
                    if (bActionAdd)
                    {
                        oActionExist = new SystemAction();
                        oActionExist.Key = strActionKey;
                    }
                    oActionExist.FunctionId = nFnId;
                    oActionExist.Name = _GetChildNodeText(nodeAction, "Name");
                    oActionExist.Description = _GetChildNodeText(nodeAction, "Description");
                    oActionExist.ActionType = _GetChildNodeText(nodeAction, "ActionType");
                    oActionExist.ActionValue = _GetChildNodeText(nodeAction, "ActionValue");
                    oActionExist.IsDefault = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsDefault"), 2);
                    oActionExist.ControlName = _GetChildNodeText(nodeAction, "ControlName");
                    oActionExist.Tip = _GetChildNodeText(nodeAction, "Tip");
                    oActionExist.IconName = _GetChildNodeText(nodeAction, "IconName");
                    oActionExist.Target = _GetChildNodeText(nodeAction, "Target");
                    oActionExist.EntityCount = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "EntityCount"), 0);
                    oActionExist.IsPopup = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsPopup"), 2);
                    oActionExist.Width = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "Width"), 0);
                    oActionExist.Height = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "Height"), 0);
                    oActionExist.IsResize = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsResize"), 2);
                    oActionExist.IsMove = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsMove"), 2);
                    oActionExist.IsIncludeMinBox = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsIncludeMinBox"), 2);
                    oActionExist.IsIncludeMaxBox = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsIncludeMaxBox"), 2);
                    oActionExist.IsShowInTaskBar = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "IsShowInTaskBar"), 2);
                    oActionExist.OrderId = TypeUtil.ParseInt(_GetChildNodeText(nodeAction, "OrderId"), 1);
                    int nActionId = SystemAction.Save(oActionExist);
                    if (nActionId <= 0)
                    {
                        _setMessage(string.Format("功能“{0}”的动作“{1}”信息保存失败!", oFnExist.Name, oActionExist.Name), true);
                        continue;
                    }
                    if (!bFnAdd)
                    {
                        htActions[strActionKey] = 1;
                    }
                }

                //删除该功能下的冗余操作(Action)
                if (!bFnAdd)
                {
                    SystemAction[] alAtions = SystemAction.GetFunctionAction(nFnId);
                    foreach (SystemAction action in alAtions)
                    {
                        if (!htActions.ContainsKey(action.Key))
                            SystemAction.Delete(action.Id);
                    }
                    _setMessage(string.Format("删除功能【{0}】冗余操作(Action)完成!", oFnExist.Name), true);
                }
            }

            ////删除该模块下的冗余功能(Function)
            if (!bModuleAdd)
            {
                SystemFunction moduleRootFn = SystemFunction.Get(strModuleKey);
                if(null == moduleRootFn)
                {
                    _setMessage("删除模块冗余功能(Function)失败!", true);
                    return;
                }

                SystemFunction[] alFns = SystemFunction.GetFunctions(moduleRootFn.Id, false);
                foreach (SystemFunction function in alFns)
                {
                    if (!htFns.ContainsKey(function.Key))
                        SystemFunction.Delete(function.Id);
                }
                _setMessage("删除模块冗余功能(Function)成功!", true);
            }

            _setMessage("模块配置完成,请刷新浏览器!", true);
        }
Esempio n. 36
0
 public static int Save(SystemModule _Entity)
 {
     int result;
     if (null == _Entity)
     {
         result = -1;
     }
     else
     {
         int nModuleId = EntityAccess<SystemModule>.Access.Save(_Entity);
         if (nModuleId <= 0)
         {
             result = -1;
         }
         else
         {
             SystemFunction rootFn = SystemFunction.Get(_Entity.Key);
             if (null == rootFn)
             {
                 rootFn = new SystemFunction();
                 rootFn.Key = _Entity.Key;
                 rootFn.ModuleId = nModuleId;
                 rootFn.Level = 1;
                 rootFn.ParentId = -1;
             }
             rootFn.Name = _Entity.Name;
             rootFn.IconName = _Entity.IconName;
             rootFn.Description = _Entity.Description;
             rootFn.OrderId = _Entity.OrderId;
             SystemFunction.Save(rootFn);
             result = nModuleId;
         }
     }
     return result;
 }
Esempio n. 37
0
 private static string __CreateNode(SystemFunction function)
 {
     string strText = function.Name;
     string strTip = function.Description;
     Hashtable ht = (Hashtable)SystemFunctionUtil.htIdToProperty[function.Id];
     int nFriendsCount = TypeUtil.ParseInt(string.Concat(ht["friend"]), 0);
     int nIndex = TypeUtil.ParseInt(string.Concat(ht["index"]), 0);
     int nLevel = function.Level;
     StringBuilder sbNode = new StringBuilder();
     int nParentId = function.ParentId;
     for (int i = 0; i < nLevel - 1; i++)
     {
         if (nParentId != -1)
         {
             SystemFunction parentFunction = (SystemFunction)SystemFunctionUtil.htIdToFunction[nParentId];
             Hashtable htParent = (Hashtable)SystemFunctionUtil.htIdToProperty[parentFunction.Id];
             int nPCount = TypeUtil.ParseInt(string.Concat(htParent["friend"]), 0);
             int nPIndex = TypeUtil.ParseInt(string.Concat(htParent["index"]), 0);
             string strBranchClassName = (nPCount == nPIndex) ? "tree-node-branch-empty" : "tree-node-branch-line";
             sbNode.Insert(0, SystemFunctionUtil.__CreateSpan("tree-node-branch-common " + strBranchClassName, ""));
             nParentId = parentFunction.ParentId;
         }
     }
     int nChildrenCount = TypeUtil.ParseInt(string.Concat(SystemFunctionUtil.htParentIdToCount[function.Id]), -1);
     if (nChildrenCount > 0)
     {
         string strDot = "tree-node-dot-plus";
         if (nLevel == 1 && nFriendsCount == 1)
         {
             strDot = "tree-node-dot-one-plus";
         }
         else
         {
             if (nLevel == 1 && nFriendsCount > 1 && nIndex == 1)
             {
                 strDot = "tree-node-dot-first-plus";
             }
             else
             {
                 if (nIndex == nFriendsCount)
                 {
                     strDot = "tree-node-dot-last-plus";
                 }
             }
         }
         sbNode.Append(SystemFunctionUtil.__CreateCommonSpan("tree-node-branch-common " + strDot, "_type=parent", true));
         string strNodeIcon = SystemFunctionUtil.__CreateSpan("tree-node-folder-normal", "");
         string strNodeText = SystemFunctionUtil.__CreateSpan("tree-node-head-text", strText);
         sbNode.Append(SystemFunctionUtil.__CreateSpan("tree-node-head-normal", strNodeIcon + strNodeText, SystemFunctionUtil.__GetTagString(function)));
     }
     else
     {
         string strDot = "tree-node-branch-middle";
         if (nLevel == 1 && nFriendsCount == 1)
         {
             strDot = "tree-node-branch-one";
         }
         else
         {
             if (nLevel == 1 && nFriendsCount > 1 && nIndex == 1)
             {
                 strDot = "tree-node-branch-first";
             }
             else
             {
                 if (nIndex == nFriendsCount)
                 {
                     strDot = "tree-node-branch-last";
                 }
             }
         }
         sbNode.Append(SystemFunctionUtil.__CreateCommonSpan("tree-node-branch-common " + strDot, "", false));
         string strNodeIcon = SystemFunctionUtil.__CreateSpan("tree-node-head-icon-leaf", "");
         string strNodeText = SystemFunctionUtil.__CreateSpan("tree-node-head-text", string.Format("<a href='#'>{0}</a>", strText));
         sbNode.Append(SystemFunctionUtil.__CreateSpan("tree-node-head-normal", strNodeIcon + strNodeText, SystemFunctionUtil.__GetTagString(function)));
     }
     return string.Format("<div class='{0} {1}'>{2}</div>", "tree-node", (nChildrenCount > 0) ? "node-parent" : "node-son", sbNode.ToString());
 }
Esempio n. 38
0
 private static string __CreateTree(SystemFunction __FunctionNode, int __NodeIndex)
 {
     int nSonCount = TypeUtil.ParseInt(string.Concat(SystemFunctionUtil.htParentIdToCount[__FunctionNode.Id]), 0);
     int nFriendCount = TypeUtil.ParseInt(string.Concat(SystemFunctionUtil.htParentIdToCount[__FunctionNode.ParentId]), 0);
     Hashtable ht = new Hashtable();
     ht["index"] = __NodeIndex;
     ht["friend"] = nFriendCount;
     ht["son"] = nSonCount;
     SystemFunctionUtil.htIdToProperty[__FunctionNode.Id] = ht;
     string strNode = SystemFunctionUtil.__CreateNode(__FunctionNode);
     if (nSonCount > 0)
     {
         int nNodeIndex = 1;
         int nLength = SystemFunctionUtil.Functions.Length;
         StringBuilder sbNodes = new StringBuilder();
         for (int i = 0; i < nLength; i++)
         {
             if (SystemFunctionUtil.Functions[i].ParentId == __FunctionNode.Id)
             {
                 sbNodes.Append(SystemFunctionUtil.__CreateTree(SystemFunctionUtil.Functions[i], nNodeIndex));
                 nNodeIndex++;
             }
         }
         strNode += string.Format("<div class='{0}'>{1}</div>", "tree-nodes-box", sbNodes.ToString());
     }
     return strNode;
 }
Esempio n. 39
0
        //public int nFunctionId = -1;
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session过期后,进入登陆界面
            int nCurrrentUserId = SystemUtil.GetCurrentUserId();
            if (nCurrrentUserId <= 0)
            {
                Control loginControl = TemplateControl.LoadControl(SystemUtil.ResovleControlPath("SystemManage", "Login"));
                ph.Controls.Add(loginControl);
                return;
            }

            int nFunctionId = PageUtil.GetQueryInt(this.Request, "fn", -1);
            int nModuleId = PageUtil.GetQueryInt(this.Request, "m", -1);
            if (nFunctionId <= 0 && nModuleId <= 0)
                return;
            SystemFunction oFunction = new SystemFunction();
            if (nFunctionId >= 1)
            {
                oFunction = SystemFunction.Get(nFunctionId);
                if (null == oFunction)
                    return;
                nModuleId = oFunction.ModuleId;
            }
            SystemModule oModule = SystemModule.Get(nModuleId);
            if (null == oModule)
                return;
            string strSingleForm = PageUtil.GetQueryString(this.Request, "fm");
            string strActionKey = PageUtil.GetQueryString(this.Request, "akey");
            string strControlName = strSingleForm;
            SystemAction[] alActions = null;
            if (string.IsNullOrEmpty(strControlName))
            {
                alActions = SystemAction.GetUserAction(nCurrrentUserId, nFunctionId);
                if (null == alActions)
                    return;
                foreach (SystemAction action in alActions)
                {
                    if (!string.IsNullOrEmpty(strActionKey) && action.Key.Equals(strActionKey))
                    {
                        strControlName = action.ControlName;
                        break;
                    }
                    else if (string.IsNullOrEmpty(strActionKey) && action.IsDefault == 1)
                    {
                        strControlName = action.ControlName;
                        strActionKey = action.Key;
                        break;
                    }
                }

                if (strActionKey.IsNullOrEmpty())
                {
                    this.ShowException("您还没有改功能的操作权限,请您联系系统管理人员解决!");
                    return;
                }

                if (!IsPostBack)
                {
                    //记录用户操作日志
                    SystemLog oLog = new SystemLog();
                    oLog.UserId = nCurrrentUserId;
                    oLog.AccessFunctionName = oFunction.Name;
                    oLog.AccessActionName = SystemAction.Get(strActionKey).Name;
                    oLog.AccessTime = DateTime.Now;
                    oLog.AccessURL = this.Page.Request.Url.AbsoluteUri;
                    oLog.Remark = string.Format("[ControlName:{0}][IP:{1}]", strControlName, this.Request.ServerVariables["REMOTE_ADDR"]);
                    SystemLog.Save(oLog);

                }
            }

            string strOtherUrl = "";
            if (!string.IsNullOrEmpty(strOtherUrl) && strOtherUrl.Length > 4 && strOtherUrl.Substring(0, 4) == "http")
            {
                Response.Write(string.Format("<iframe frameborder=\"0\" src=\"{0}\" scrolling=\"auto\" height=\"100%\" width=\"100%\"></iframe>", strOtherUrl));
                return;
            }

            string strControlPath = string.IsNullOrEmpty(strOtherUrl) ? SystemUtil.ResovleControlPath(oModule.Controller, strControlName) : strOtherUrl;
            Control loadControl = null;
            try
            {
                loadControl = LoadControl(strControlPath);
                ph.Controls.Add(loadControl);
            }
            catch(Exception ex)
            {
                this.ShowException(string.Format("控件加载失败!<br /><br />原因:{0}", ex.Message));
                return;
            }

            Control toolBar = loadControl.FindControl("toolBar");
            if (null != toolBar)
            {
                (toolBar as HtmlControl).Attributes["class"] = "toolBar";
                foreach (SystemAction action in alActions)
                {
                    HyperLink toolAction = new HyperLink();
                    toolAction.ID = "Action_" + action.Key;
                    toolAction.CssClass = action.Key == strActionKey ? "action-active" : "action-normal";
                    toolAction.ToolTip = action.Tip;
                    toolAction.Attributes["onclick"] = action.Key == strActionKey ? "void(0);" : string.Format("formUtil.actionDone({0});", action.ToActionJson());
                    toolAction.NavigateUrl = "javascript:void(0);";

                    HtmlGenericControl spanText = new HtmlGenericControl("span");
                    spanText.InnerText = action.Name;

                    HtmlImage toolIcon = new HtmlImage(); //图标必须是16像素宽高
                    toolIcon.Width = 16;
                    toolIcon.Height = 16;
                    toolIcon.Align = "absMiddle";
                    toolIcon.Attributes["hspace"] = "2";
                    toolIcon.Src = SystemUtil.ResovleActionImagePath(action.IconName);

                    toolAction.Controls.Add(toolIcon);
                    toolAction.Controls.Add(spanText);
                    toolBar.Controls.Add(toolAction);
                }
            }

            //页面Postback后清空复选框选择值隐藏域
            hiddenSelectedValue.Value = "";
        }
Esempio n. 40
0
 private static string __GetTagString(SystemFunction _FuncObj)
 {
     string result;
     if (null == _FuncObj)
     {
         result = "";
     }
     else
     {
         int nChildrenCount = TypeUtil.ParseInt(string.Concat(SystemFunctionUtil.htParentIdToCount[_FuncObj.Id]), -1);
         string strNodeType = (nChildrenCount > 0) ? "parent" : "son";
         StringBuilder sbTag = new StringBuilder();
         sbTag.Append(string.Format(" _tag=\"{0}\"", _FuncObj.Id));
         sbTag.Append(string.Format(" _type=\"{0}\"", strNodeType));
         sbTag.Append(string.Format(" _name=\"{0}\"", _FuncObj.Name.Replace("\"", "").Replace("'", "")));
         sbTag.Append(string.Format(" _value=\"{0}\"", _FuncObj.Id));
         sbTag.Append(string.Format(" _icon=\"{0}\"", _FuncObj.IconName));
         result = sbTag.ToString();
     }
     return result;
 }