Exemple #1
0
        public string SetSubInc(string userNo)
        {
            //检查是否有该用户.
            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = userNo;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@用户编号错误:" + userNo);
            }

            AdminEmp ad = new AdminEmp();

            ad.No = userNo + "@" + this.No;
            if (ad.RetrieveFromDBSources() == 1)
            {
                return("err@该用户已经是该公司的管理员了.");
            }

            ad.Copy(emp);
            ad.No         = userNo + "@" + this.No; //增加一个影子版本.
            ad.RootOfDept = this.No;
            ad.RootOfFlow = "Inc" + this.No;
            ad.RootOfForm = "Inc" + this.No;
            ad.UserType   = 1;
            ad.UseSta     = 1;
            ad.Insert();

            //设置二级管理员.
            ad.No = userNo;
            if (ad.RetrieveFromDBSources() == 0)
            {
                ad.Copy(emp);
                ad.RootOfDept = this.No;
                ad.RootOfFlow = "Inc" + this.No;
                ad.RootOfForm = "Inc" + this.No;
                ad.UserType   = 1;
                ad.UseSta     = 1;
                ad.Insert();
            }
            else
            {
                ad.RootOfDept = this.No;
                ad.RootOfFlow = "Inc" + this.No;
                ad.RootOfForm = "Inc" + this.No;
                ad.UserType   = 1;
                ad.UseSta     = 1;
                ad.Update();
            }

            //初始化表单树,流程树.
            InitFlowSortTree();

            return("设置成功,[" + ad.No + "," + ad.Name + "]重新登录就可以看到.");
        }
Exemple #2
0
        public string DoType(string doType, string v1, string v2, string v3, string v4, string v5)
        {
            try
            {
                switch (doType)
                {
                case "FrmTreeUp":     // 表单树
                    SysFormTree sft = new SysFormTree();
                    sft.DoUp();
                    return(null);

                case "FrmTreeDown":     // 表单树
                    SysFormTree sft1 = new SysFormTree();
                    sft1.DoDown();
                    return(null);

                case "FrmUp":
                    MapData md1 = new MapData(v1);
                    md1.DoOrderDown();
                    return(null);

                case "FrmDown":
                    MapData md = new MapData(v1);
                    md.DoOrderDown();
                    return(null);

                case "AdminLogin":
                    try
                    {
                        //if (BP.Sys.SystemConfig.IsDebug == true)
                        //    return null;

                        BP.Port.Emp emp = new BP.Port.Emp();
                        emp.No = v1;
                        emp.RetrieveFromDBSources();

                        if (emp.Pass == v2)
                        {
                            BP.Web.WebUser.SignInOfGener(emp);

                            return
                                (Newtonsoft.Json.JsonConvert.SerializeObject(
                                     new
                            {
                                success = true,
                                msg = string.Empty,
                                data = new { no = emp.No, name = emp.Name, sid = BP.Web.WebUser.SID }
                            }));
                        }

                        return(Newtonsoft.Json.JsonConvert.SerializeObject(
                                   new { success = false, msg = "用户名或密码错误" }));
                    }
                    catch (Exception ex)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(
                                   new { success = false, msg = ex.Message }));
                    }

                case "DeleteFrmSort":
                    SysFormTree fs = new SysFormTree();
                    fs.No = v1;
                    fs.Delete();
                    SysFormTree ft = new SysFormTree();
                    ft.No = v1;
                    ft.Delete();
                    return(null);

                case "DeleteFrm":     //删除表单.
                case "DelFrm":
                    MapData md4 = new MapData();
                    md4.No = v1;
                    md4.Delete();
                    return(null);

                case "InitDesignerXml":
                    string  path = BP.Sys.SystemConfig.PathOfData + "\\Xml\\Designer.xml";
                    DataSet ds   = new DataSet();
                    ds.ReadXml(path);
                    ds = this.TurnXmlDataSet2SLDataSet(ds);
                    return(Silverlight.DataSetConnector.Connector.ToXml(ds));

                default:
                    throw new Exception("没有判断的,功能编号" + doType);
                }
            }
            catch (Exception ex)
            {
                BP.DA.Log.DefaultLogWriteLineError("执行错误,功能编号" + doType + " error:" + ex.Message);
                throw new Exception("执行错误,功能编号" + doType + " error:" + ex.Message);
            }
        }