示例#1
0
        /// <summary>
        /// 保存用户自定义添加的管理对象
        /// </summary>
        /// <param name="treetabconfig"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public bool Save(string treetabconfig, long userid, long phid)
        {
            string sql = "select count(*) from fg3_mainframe_individual where userid =" + userid + " and usertype = 0 ";
            string obj = DbHelper.GetString(sql).ToString();

            if (obj == "0")
            {
                //Int64 masterid = this.GetMaxID("fg3_mainframe_individual") + 1;
                sql = "insert into fg3_mainframe_individual (phid,userid,treetabconfig,usertype) values ( " + phid + "," + userid + ",'" + treetabconfig + "',0)";
            }
            else
            {
                sql = "update fg3_mainframe_individual set treetabconfig = '" + treetabconfig + "' where userid =" + userid + " and usertype = 0 ";
            }
            try
            {
                DbHelper.ExecuteScalar(sql);
                string dateflag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                UserConfigDac.UserConfigSave(userid, 0, dateflag);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
示例#2
0
        public bool SaveAPPLogo(long phid, string APPlogo, string attachid, int isSys)
        {
            long   userid   = AppInfoBase.UserID;
            string dateflag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string sql      = "select count(*) from fg3_mainframe_individual where userid =" + userid + " and usertype = 0 ";
            string obj      = DbHelper.GetString(sql).ToString();

            if (obj == "0")
            {
                sql = "insert into fg3_mainframe_individual (phid,userid,usertype,applogoname,applogoattachid,applogodateflg,issys) values ( "
                      + phid + "," + userid + ",0,'" + APPlogo + "','" + attachid + "','" + dateflag + "'," + isSys + ")";
            }
            else
            {
                sql = "update fg3_mainframe_individual set applogoname = '" + APPlogo + "', applogoattachid = '" + attachid +
                      "', applogodateflg = '" + dateflag + "', isSys = " + isSys + " where userid =" + userid + " and usertype = 0 ";
            }
            try
            {
                DbHelper.ExecuteScalar(sql);
                UserConfigDac.UserConfigSave(userid, 0, dateflag);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
示例#3
0
        public string Save(string svgConfig, string text, string saveType, long phid)
        {
            long userid = AppInfoBase.UserID;
            //Int64 masterid = this.GetMaxID("fg3_function_navigation") + 1;
            string sql;

            if (saveType == "add")
            {
                sql = String.Format(@"select count(*) from fg3_function_navigation where userid ={0} and usertype = 0 and text ='{1}'", userid, text);
                string obj = DbHelper.GetString(sql).ToString();
                int    i   = 1;
                if (obj != "0")
                {
                    return("rename");
                }
                sql = String.Format(@"insert into fg3_function_navigation (phid,userid,svgconfig,usertype,text) values ({0},{1},'{2}',0,'{3}')", phid, userid, svgConfig, text);
            }
            else
            {
                if (text == "默认功能导航图")
                {
                    //sql = "update fg3_function_navigation set svgconfig = '" + svgConfig + "',text = '默认功能导航图' where userid =" + userid + " and usertype = 0 and  and text is null";
                    sql = String.Format(@"update fg3_function_navigation set svgconfig = '{0}',text = '默认功能导航图' where userid ={1} and usertype = 0 and  and text is null", svgConfig, userid);
                }
                else
                {
                    //sql = "update fg3_function_navigation set svgconfig = '" + svgConfig + "' where userid =" + userid + " and usertype = 0 and text =" + text;
                    sql = String.Format(@"update fg3_function_navigation set svgconfig = '{0}' where userid ={1} and usertype = 0 and text ='{2}'", svgConfig, userid, text);
                }
            }

            //string sql = "select count(*) from fg3_function_navigation where userid =" + userid + " and usertype = 0 ";
            //string obj = DbHelper.GetString(sql).ToString();
            //if (obj == "0")
            //{
            //    Int64 masterid = this.GetMaxID("fg3_function_navigation") + 1;
            //    sql = "insert into fg3_function_navigation (phid,userid,svgconfig,usertype) values ( " + masterid + "," + userid + ",'" + svgConfig + "',0)";
            //}
            //else
            //{
            //    sql = "update fg3_function_navigation set svgconfig = '" + svgConfig + "' where userid =" + userid + " and usertype = 0 ";
            //}
            try
            {
                DbHelper.ExecuteScalar(sql);
                string dateflag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                UserConfigDac.UserConfigSave(userid, 0, dateflag);
                return("true");
            }
            catch (Exception ex)
            {
                return("false");

                throw new Exception(ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// 保存功能分类
        /// </summary>
        /// <param name="rows"></param>
        public int SaveMyMenuType(string rows)
        {
            JArray ja     = (JArray)JsonConvert.DeserializeObject(rows);
            long   userid = NG3.AppInfoBase.UserID;
            string logid  = NG3.AppInfoBase.LoginID;
            string sql    = string.Format("delete from my_menu_type where (userid={0} and usertype = 0) or logid = '{1}'", userid, logid);
            int    iret   = DbHelper.ExecuteNonQuery(sql);

            if (ja.Count < 1)//删除用户我的功能树所有节点
            {
                return(1);
            }

            string    sqlText  = string.Format("select * from my_menu_type where (userid={0} and usertype = 0)", userid);
            DataTable dt       = DbHelper.GetDataTable(sqlText);
            DataTable newTable = dt.Clone();

            for (int i = 0; i < ja.Count; i++)
            {
                DataRow newRow = newTable.NewRow();
                newRow.BeginEdit();
                newRow["code"]     = string.IsNullOrEmpty(ja[i]["code"].ToString())?Guid.NewGuid().ToString(): ja[i]["code"].ToString();
                newRow["userid"]   = userid;
                newRow["name"]     = ja[i]["name"].ToString();
                newRow["usertype"] = 0;
                //newRow["lineid"] = ja[i]["lineid"].ToString();
                newRow["lineid"] = (i + 1).ToString();
                newRow["logid"]  = logid;
                newRow["def1"]   = null;
                newRow.EndEdit();
                newTable.Rows.Add(newRow);
            }

            string dateflag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            UserConfigDac.UserConfigSave(userid, 0, dateflag);
            return(DbHelper.Update(newTable, "select * from my_menu_type"));
        }
示例#5
0
        public int Save(DataTable masterdt, long userid, List <long> phid)
        {
            string sql = string.Format("delete from fg3_myfunctree where userid={0} and usertype = 0", userid);
            //string sql = "delete from fg3_myfunctree where userid=" + userid + "";
            int iret = DbHelper.ExecuteNonQuery(sql);

            if (masterdt.Rows.Count == 0)//删除用户我的功能树所有节点
            {
                return(1);
            }
            //Int64 masterid = this.GetMaxID("fg3_myfunctree");
            int i = 0;

            //处理主表的主键
            foreach (DataRow dr in masterdt.Rows)
            {
                if (dr.RowState == DataRowState.Deleted)
                {
                    continue;
                }

                if (dr.RowState == DataRowState.Added)
                {
                    //Guid.NewGuid().ToString();//主表的主键
                    //dr["phid"] = ++masterid;
                    dr["phid"]     = phid[i++];
                    dr["userid"]   = userid;
                    dr["usertype"] = 0;
                }
            }
            string dateflag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            UserConfigDac.UserConfigSave(userid, 0, dateflag);
            int m = DbHelper.Update(masterdt, "select * from fg3_myfunctree");

            return(m);
        }
示例#6
0
        /// <summary>
        /// 批量保存数据到选项明细表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="logid"></param>
        /// <returns></returns>
        public DataTable SaveShortcutMenu(DataTable dt)
        {
            try
            {
                long      userid     = NG3.AppInfoBase.UserID;
                DataTable dtShortcut = new DataTable();
                string    dateflag   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                int affectrows = DbHelper.ExecuteNonQuery("delete from fg3_shortcutmenu where userid=" + userid + "");
                if (dt.Rows.Count > 0)
                {
                    IList <long> phidList = this.GetPhidList(dt.Rows.Count, "phid", 1, "fg3_shortcutmenu");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dt.Rows[i]["phid"]   = phidList[i];
                        dt.Rows[i]["seq"]    = i + 1;
                        dt.Rows[i]["userid"] = NG3.AppInfoBase.UserID;
                    }
                    int rows = DbHelper.Update(dt, "select * from fg3_shortcutmenu");
                    if (rows > 0)
                    {
                        UserConfigDac.UserConfigSave(userid, 0, dateflag);
                        StringBuilder strbuilder = new StringBuilder();
                        strbuilder.Append("select a.displayname,a.shortcutkey,a.url,a.urlparam,a.name as str,b.managername,b.moduleno,b.code as id,b.suite,b.rightkey,b.norightcontrol");
                        strbuilder.Append(" from fg3_shortcutmenu a left join fg3_menu b on a.busphid = b.busphid and a.originalcode = b.code where a.userid=" + userid + " order by a.seq asc");
                        dtShortcut = DbHelper.GetDataTable(strbuilder.ToString());
                        dtShortcut = this.RightkeyController(dtShortcut);
                    }
                }
                return(dtShortcut);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }