コード例 #1
0
        private string GetFormula(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            int flag = 0;

            try
            {
                Business.Base.BusinessFormula bf = new Business.Base.BusinessFormula();
                var formulaList = new List <EntityFormula>();
                foreach (EntityFormula item in bf.GetList(string.Empty, string.Empty, string.Empty, 0, 0))
                {
                    formulaList.Add(item);
                }
                collection.Add(new JsonStringValue("data", JsonConvert.SerializeObject(formulaList.Select(a => new { a.ID, a.Name, a.Explanation }))));
            }
            catch (Exception ex)
            {
                flag = 2;
                collection.Add(new JsonStringValue("ex", ex.ToString()));
            }
            collection.Add(new JsonStringValue("type", "getFormula"));
            collection.Add(new JsonNumericValue("flag", flag));
            return(collection.ToString());
        }
コード例 #2
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                HttpCookie hc = getCookie("1");
                if (hc != null)
                {
                    string str = hc.Value.Replace("%3D", "=");
                    userid = Encrypt.DecryptDES(str, "1");
                    user.load(userid);
                    CheckRight(user.Entity, "pm/Base/Service.aspx");

                    if (!Page.IsCallback)
                    {
                        if (user.Entity.UserType.ToUpper() != "ADMIN")
                        {
                            string sqlstr = "select a.RightCode from Sys_UserRight a left join sys_menu b on a.MenuId=b.MenuID " +
                                            "where a.UserType='" + user.Entity.UserType + "' and menupath='pm/Base/Service.aspx'";
                            DataTable dt = obj.PopulateDataSet(sqlstr).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                string rightCode = dt.Rows[0]["RightCode"].ToString();
                                if (rightCode.IndexOf("insert") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe600;</i> 添加</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("update") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe60c;</i> 修改</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("delete") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\">&#xe6e2;</i> 删除</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("vilad") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe615;</i> 启用/停用</a>&nbsp;&nbsp;";
                                }
                            }
                        }
                        else
                        {
                            Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe600;</i> 添加</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe60c;</i> 修改</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\">&#xe6e2;</i> 删除</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe615;</i> 启用/停用</a>&nbsp;&nbsp;";
                        }

                        list = createList(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, 1);

                        //第一级服务类别
                        Business.Base.BusinessServiceType bst = new project.Business.Base.BusinessServiceType();
                        foreach (Entity.Base.EntityServiceType it in bst.GetListQuery(string.Empty, string.Empty, "null", string.Empty, true))
                        {
                            ServiceTypeList += string.Format("<option value='{0}'>{1}</option>", it.SRVTypeNo, it.SRVTypeName);
                        }
                        //服务商
                        Business.Base.BusinessServiceProvider bsp = new project.Business.Base.BusinessServiceProvider();
                        foreach (Entity.Base.EntityServiceProvider it in bsp.GetListQuery(string.Empty, string.Empty, true))
                        {
                            ProviderList += string.Format("<option value='{0}'>{1}</option>", it.SPNo, it.SPShortName);
                        }
                        //公式
                        Business.Base.BusinessFormula bf = new Business.Base.BusinessFormula();
                        foreach (EntityFormula it in bf.GetList(string.Empty, string.Empty, string.Empty, 0, 0))
                        {
                            FormulaList += string.Format("<option value='{0}' data-tip='{1}'>{2}</option>", it.ID, it.Explanation, it.Name);
                        }
                    }
                }
                else
                {
                    Response.Write(errorpage);
                    return;
                }
            }
            catch
            {
                Response.Write(errorpage);
                return;
            }
        }