Ejemplo n.º 1
0
        public void UpdateMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec             SFCDB = _DBPools["SFCDB"].Borrow();
            MESDataObject.Module.T_C_MENU   tcm   = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE);
            MESDataObject.Module.Row_C_MENU rcm   = (MESDataObject.Module.Row_C_MENU)tcm.NewRow();
            string UpdateSQL = "";

            SFCDB.BeginTrain();
            try
            {
                string m_name = Data["MENU_NAME"].ToString();
                string m_desc = Data["MENU_DESC"].ToString();
                string m_emp  = Data["EDIT_EMP"].ToString();
                string m_id   = Data["ID"].ToString();
                rcm             = tcm.getC_MenubyID(m_id, SFCDB);
                rcm.MENU_NAME   = m_name;
                rcm.PAGE_PATH   = Data["PAGE_PATH"].ToString();
                rcm.STYLE_NAME  = Data["STYLE_NAME"].ToString();
                rcm.CLASS_NAME  = Data["CLASS_NAME"].ToString();
                rcm.LANGUAGE_ID = Data["LANGUAGE_ID"].ToString();
                rcm.MENU_DESC   = m_desc;
                rcm.EDIT_TIME   = DateTime.Now;
                rcm.EDIT_EMP    = m_emp;
                UpdateSQL      += rcm.GetUpdateString(this.DBTYPE) + ";\n";

                MESDataObject.Module.T_C_PRIVILEGE   tcp = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, this.DBTYPE);
                MESDataObject.Module.Row_C_PRIVILEGE rcp = (MESDataObject.Module.Row_C_PRIVILEGE)tcp.NewRow();
                rcp = tcp.getC_PrivilegebyMenuID(m_id, SFCDB);
                rcp.PRIVILEGE_NAME = m_name;
                rcp.PRIVILEGE_DESC = m_desc;
                rcp.EDIT_TIME      = DateTime.Now;
                rcp.EDIT_EMP       = m_emp;
                UpdateSQL         += rcp.GetUpdateString(this.DBTYPE) + ";\n";
                SFCDB.ExecSQL("Begin\n" + UpdateSQL + "End;");
                SFCDB.CommitTrain();
                this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status  = StationReturnStatusValue.Pass;
                StationReturn.Message = "编辑菜單成功!!";
            }
            catch (Exception ex)
            {
                SFCDB.RollbackTrain();
                this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "编辑菜單失敗!!";
                StationReturn.Data    = ex.Message.ToString();
            }
        }
Ejemplo n.º 2
0
        public void OrderbyMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow();
            string PARENTID           = Data["PARENTID"].ToString();
            int    index = 10;
            string sql   = "";

            SFCDB.BeginTrain();
            try
            {
                MESDataObject.Module.T_C_MENU   tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE);
                MESDataObject.Module.Row_C_MENU rcm = (MESDataObject.Module.Row_C_MENU)tcm.NewRow();
                foreach (string item in Data["MENUIDS"])
                {
                    rcm = tcm.getC_MenubyIDandPARENT(item.Trim('\'').Trim('\"'), PARENTID, SFCDB);
                    if (rcm != null)
                    {
                        rcm.SORT = index;
                        sql     += rcm.GetUpdateString(this.DBTYPE) + ";\n";
                        index   += 10;
                    }
                }
                SFCDB.ExecSQL("Begin\n" + sql + "End;");
                SFCDB.CommitTrain();
                StationReturn.Status  = StationReturnStatusValue.Pass;
                StationReturn.Message = "排序菜单信息成功!";
                this.DBPools["SFCDB"].Return(SFCDB);
            }
            catch (Exception ex)
            {
                SFCDB.RollbackTrain();
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "排序菜单信息失败!";
                StationReturn.Data    = ex.Message.ToString();
                this.DBPools["SFCDB"].Return(SFCDB);
            }
        }