Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Company model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Company set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Website=@Website,");
            strSql.Append("Address=@Address,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Industry=@Industry,");
            strSql.Append("EnterpriseType=@EnterpriseType,");
            strSql.Append("Principal=@Principal,");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("obj_ID=@obj_ID");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",           SqlDbType.VarChar,   20),
                new SqlParameter("@Website",        SqlDbType.VarChar,   20),
                new SqlParameter("@Address",        SqlDbType.VarChar,   50),
                new SqlParameter("@Tel",            SqlDbType.VarChar,   20),
                new SqlParameter("@Industry",       SqlDbType.VarChar,   20),
                new SqlParameter("@EnterpriseType", SqlDbType.VarChar,   20),
                new SqlParameter("@Principal",      SqlDbType.VarChar,   20),
                new SqlParameter("@CreateTime",     SqlDbType.DateTime),
                new SqlParameter("@obj_ID",         SqlDbType.DateTime),
                new SqlParameter("@ID",             SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Website;
            parameters[2].Value = model.Address;
            parameters[3].Value = model.Tel;
            parameters[4].Value = model.Industry;
            parameters[5].Value = model.EnterpriseType;
            parameters[6].Value = model.Principal;
            parameters[7].Value = model.CreateTime;
            parameters[8].Value = model.obj_ID;
            parameters[9].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Company DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Company model = new Maticsoft.Model.Company();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Website"] != null)
         {
             model.Website = row["Website"].ToString();
         }
         if (row["Address"] != null)
         {
             model.Address = row["Address"].ToString();
         }
         if (row["Tel"] != null)
         {
             model.Tel = row["Tel"].ToString();
         }
         if (row["Industry"] != null)
         {
             model.Industry = row["Industry"].ToString();
         }
         if (row["EnterpriseType"] != null)
         {
             model.EnterpriseType = row["EnterpriseType"].ToString();
         }
         if (row["Principal"] != null)
         {
             model.Principal = row["Principal"].ToString();
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["obj_ID"] != null && row["obj_ID"].ToString() != "")
         {
             model.obj_ID = int.Parse(row["obj_ID"].ToString());
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.Company model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Company(");
            strSql.Append("Name,Website,Address,Tel,Industry,EnterpriseType,Principal,CreateTime,obj_ID)");
            strSql.Append(" values (");
            strSql.Append("@Name,@Website,@Address,@Tel,@Industry,@EnterpriseType,@Principal,@CreateTime,@obj_ID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",           SqlDbType.VarChar,   20),
                new SqlParameter("@Website",        SqlDbType.VarChar,   20),
                new SqlParameter("@Address",        SqlDbType.VarChar,   50),
                new SqlParameter("@Tel",            SqlDbType.VarChar,   20),
                new SqlParameter("@Industry",       SqlDbType.VarChar,   20),
                new SqlParameter("@EnterpriseType", SqlDbType.VarChar,   20),
                new SqlParameter("@Principal",      SqlDbType.VarChar,   20),
                new SqlParameter("@CreateTime",     SqlDbType.DateTime),
                new SqlParameter("@obj_ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Website;
            parameters[2].Value = model.Address;
            parameters[3].Value = model.Tel;
            parameters[4].Value = model.Industry;
            parameters[5].Value = model.EnterpriseType;
            parameters[6].Value = model.Principal;
            parameters[7].Value = model.CreateTime;
            parameters[8].Value = model.obj_ID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Company model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Company set ");
            strSql.Append("Name=@Name,");
            strSql.Append("CStatus=@CStatus,");
            strSql.Append("COrder=@COrder,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("CreateUser=@CreateUser,");
            strSql.Append("ParentId=@ParentId");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",       SqlDbType.NVarChar,  500),
                new SqlParameter("@CStatus",    SqlDbType.NVarChar,   50),
                new SqlParameter("@COrder",     SqlDbType.Float,       8),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@CreateUser", SqlDbType.NVarChar,  100),
                new SqlParameter("@ParentId",   SqlDbType.Int,         4),
                new SqlParameter("@Id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.CStatus;
            parameters[2].Value = model.COrder;
            parameters[3].Value = model.CreateDate;
            parameters[4].Value = model.CreateUser;
            parameters[5].Value = model.ParentId;
            parameters[6].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Company model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Company(");
            strSql.Append("Id,Name,CStatus,COrder,CreateDate,CreateUser,ParentId)");
            strSql.Append(" values (");
            strSql.Append("@Id,@Name,@CStatus,@COrder,@CreateDate,@CreateUser,@ParentId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",         SqlDbType.Int,         4),
                new SqlParameter("@Name",       SqlDbType.NVarChar,  500),
                new SqlParameter("@CStatus",    SqlDbType.NVarChar,   50),
                new SqlParameter("@COrder",     SqlDbType.Float,       8),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@CreateUser", SqlDbType.NVarChar,  100),
                new SqlParameter("@ParentId",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.CStatus;
            parameters[3].Value = model.COrder;
            parameters[4].Value = model.CreateDate;
            parameters[5].Value = model.CreateUser;
            parameters[6].Value = model.ParentId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Company DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Company model = new Maticsoft.Model.Company();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["CStatus"] != null)
         {
             model.CStatus = row["CStatus"].ToString();
         }
         if (row["COrder"] != null && row["COrder"].ToString() != "")
         {
             model.COrder = decimal.Parse(row["COrder"].ToString());
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
         if (row["CreateUser"] != null)
         {
             model.CreateUser = row["CreateUser"].ToString();
         }
         if (row["ParentId"] != null && row["ParentId"].ToString() != "")
         {
             model.ParentId = int.Parse(row["ParentId"].ToString());
         }
     }
     return(model);
 }
Esempio n. 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Company GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,Name,CStatus,COrder,CreateDate,CreateUser,ParentId from Company ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            Maticsoft.Model.Company model = new Maticsoft.Model.Company();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Company GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Name,Website,Address,Tel,Industry,EnterpriseType,Principal,CreateTime,obj_ID from Company ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.Company model = new Maticsoft.Model.Company();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 用户中心登陆
        /// </summary>
        /// <returns></returns>
        public ActionResult UserCenterLogin()
        {
            ConfigurationHelper config = new ConfigurationHelper();
            string WebUrl = config.getConfigName("WebUrl");

            string    token = Request.QueryString["token"]?.ToString();
            DataTable dt    = null;

            if (!string.IsNullOrEmpty(token))
            {
                token = HttpUtility.UrlEncode(token, System.Text.Encoding.UTF8);
                token = Setpassword.get_password_ASC(HttpUtility.UrlDecode(token));
                dt    = JsonConvert.DeserializeObject(token, typeof(DataTable)) as DataTable;
            }

            if (dt != null && dt.Rows.Count > 0)//表示token能解析出对象
            {
                DateTime time = Convert.ToDateTime(dt.Rows[0]["CreateDate"]);
                if (time.Date == DateTime.Now.Date)
                {
                    DataTable userTable = BUserInfo.GetList("UrGuid='" + dt.Rows[0]["UserGuid"].ToString() + "'").Tables[0];
                    //处理dt
                    if (userTable.Rows.Count > 0)//如果存在这个guid 表示用户存在
                    {
                        //存在还要判断数据是否有被修改
                        int    companyId   = Convert.ToInt32(dt.Rows[0]["CompanyID"]);
                        string companyName = dt.Rows[0]["CompanyName"].ToString();
                        //先开始判断公司
                        MCompany = BCompany.GetModel(companyId);
                        if (MCompany == null)
                        {
                            //创建公司
                            MCompany = new Maticsoft.Model.Company()
                            {
                                Id = companyId, Name = companyName
                            };
                            BCompany.Add(MCompany);
                        }
                        else//表示存在公司
                        {
                            if (MCompany.Name != companyName)//表示数据更改
                            {
                                string         sql   = "update company set Name=@Name where Id=@Id";
                                SqlParameter[] paras =
                                {
                                    new SqlParameter("@Name", companyName),
                                    new SqlParameter("@Id",   companyId)
                                };
                                DbHelperSQL.ExecuteSql(sql, paras);
                            }
                        }

                        int       departmentId    = Convert.ToInt32(dt.Rows[0]["DepartmentID"]);
                        int       newDepartmentId = 0;
                        string    departmentName  = dt.Rows[0]["DepartmentName"].ToString();
                        DataTable departmentTable = BDepartment.GetList("UcDepartmentId = " + departmentId).Tables[0];
                        if (departmentTable.Rows.Count > 0)//表示已经存在部门
                        {
                            newDepartmentId = Convert.ToInt32(departmentTable.Rows[0]["ID"]);
                            if (departmentTable.Rows[0]["Name"].ToString() != departmentName || departmentTable.Rows[0]["CpId"].ToString() != companyId.ToString())//表示部门名称更改,更新部门名称
                            {
                                string         sql   = "update Department set UcDepartmentId=@UcDepartmentId,Name=@Name,CpId=@CpId where Id=@Id";
                                SqlParameter[] paras =
                                {
                                    new SqlParameter("@UcDepartmentId", departmentId),
                                    new SqlParameter("@CpId",           companyId),
                                    new SqlParameter("@Name",           departmentName),
                                    new SqlParameter("@Id",             newDepartmentId)
                                };
                                DbHelperSQL.ExecuteSql(sql, paras);
                            }
                        }
                        else
                        {
                            //不存在部门,新增
                            MDepartment = new Maticsoft.Model.Department()
                            {
                                CpId = companyId, UcDepartmentId = departmentId, Name = departmentName
                            };
                            newDepartmentId = BDepartment.Add(MDepartment);
                        }

                        //处理用户

                        if (userTable.Rows[0]["UserName"].ToString() != dt.Rows[0]["UserPhone"].ToString() || dt.Rows[0]["UserName"].ToString() != userTable.Rows[0]["TrueName"].ToString() || Convert.ToInt32(userTable.Rows[0]["DepartmentId"]) != newDepartmentId || userTable.Rows[0]["HeadImage"].ToString() != dt.Rows[0]["UserHeadImage"].ToString())
                        {
                            //表示用户信息有被更改
                            string         sql   = "update Userinfo set UserName=@UserName,TrueName=@TrueName,DepartmentId=@DepartmentId,HeadImage=@HeadImage where Id=@Id";
                            SqlParameter[] paras =
                            {
                                new SqlParameter("@UserName",     dt.Rows[0]["UserPhone"].ToString()),
                                new SqlParameter("@TrueName",     dt.Rows[0]["UserName"].ToString()),
                                new SqlParameter("@HeadImage",    dt.Rows[0]["UserHeadImage"].ToString()),
                                new SqlParameter("@DepartmentId", newDepartmentId),
                                new SqlParameter("@Id",           Convert.ToInt32(userTable.Rows[0]["ID"]))
                            };
                            DbHelperSQL.ExecuteSql(sql, paras);
                        }

                        string name   = userTable.Rows[0]["TrueName"].ToString();
                        string ID     = userTable.Rows[0]["ID"].ToString();
                        string RoleID = userTable.Rows[0]["RoleID"].ToString();
                        Session.Add("UserInfoID", ID);
                        Session.Add("TrueName", name);
                        Session.Add("RoleID", RoleID);
                        Session.Timeout = 40;
                        return(RedirectToAction("Index", "Window"));


                        //string ID = userTable.Rows[0]["ID"].ToString();
                        //Session.Add("UserInfoID", ID);
                        //Session.Add("RoleID", 3);//默认都是反馈人员
                        //Session.Add("TrueName", MUserInfo.TrueName);
                        //Session.Timeout = 40;
                        //return RedirectToAction("Index", "Window");
                    }
                    else //表示不存在这个用户
                    {
                        int    companyId   = Convert.ToInt32(dt.Rows[0]["CompanyID"]);
                        string companyName = dt.Rows[0]["CompanyName"].ToString();
                        //先开始判断公司
                        MCompany = BCompany.GetModel(companyId);
                        if (MCompany == null)
                        {
                            //创建公司
                            MCompany = new Maticsoft.Model.Company()
                            {
                                Id = companyId, Name = companyName
                            };
                            BCompany.Add(MCompany);
                        }
                        else//表示存在公司
                        {
                            if (MCompany.Name != companyName)//表示数据更改
                            {
                                string         sql   = "update company set Name=@Name where Id=@Id";
                                SqlParameter[] paras =
                                {
                                    new SqlParameter("@Name", companyName),
                                    new SqlParameter("@Id",   companyId)
                                };
                                DbHelperSQL.ExecuteSql(sql, paras);
                            }
                        }
                        int       departmentId    = Convert.ToInt32(dt.Rows[0]["DepartmentID"]);
                        int       newDepartmentId = 0;
                        string    departmentName  = dt.Rows[0]["DepartmentName"].ToString();
                        DataTable departmentTable = BDepartment.GetList("UcDepartmentId = " + departmentId).Tables[0];
                        if (departmentTable.Rows.Count > 0)//表示已经存在部门
                        {
                            newDepartmentId = Convert.ToInt32(departmentTable.Rows[0]["ID"]);
                            if (departmentTable.Rows[0]["Name"].ToString() != departmentName || departmentTable.Rows[0]["CpId"].ToString() != companyId.ToString())//表示部门名称更改,更新部门名称
                            {
                                string         sql   = "update Department set UcDepartmentId=@UcDepartmentId,Name=@Name,CpId=@CpId where Id=@Id";
                                SqlParameter[] paras =
                                {
                                    new SqlParameter("@UcDepartmentId", departmentId),
                                    new SqlParameter("@Name",           departmentName),
                                    new SqlParameter("@CpId",           companyId),
                                    new SqlParameter("@Id",             newDepartmentId)
                                };
                                DbHelperSQL.ExecuteSql(sql, paras);
                            }
                        }
                        else
                        {
                            //不存在部门,新增
                            MDepartment = new Maticsoft.Model.Department()
                            {
                                CpId = companyId, UcDepartmentId = departmentId, Name = departmentName
                            };
                            newDepartmentId = BDepartment.Add(MDepartment);
                        }
                        //创建用户
                        MUserInfo.ParentID     = 1;    //默认上级是超级管理员
                        MUserInfo.Password     = "";   // password.set_password_ASC("888888");
                        MUserInfo.PrivilegeID  = "17"; //默认权限
                        MUserInfo.RoleID       = 3;
                        MUserInfo.status       = Convert.ToInt32(1);
                        MUserInfo.Time         = System.DateTime.Now;
                        MUserInfo.UserFrom     = "ERP-User";
                        MUserInfo.DepartmentID = newDepartmentId;
                        MUserInfo.TrueName     = dt.Rows[0]["UserName"].ToString();  //用户真实姓名
                        MUserInfo.UserName     = dt.Rows[0]["UserPhone"].ToString(); //用户昵称,就是手机号
                        MUserInfo.UrGuid       = dt.Rows[0]["UserGuid"].ToString();
                        MUserInfo.HeadImage    = dt.Rows[0]["UserHeadImage"].ToString();
                        int check = BUserInfo.Add(MUserInfo);
                        if (check > 0)
                        {
                            Session.Add("UserInfoID", check);
                            Session.Add("RoleID", 3);//默认都是反馈人员
                            Session.Add("TrueName", MUserInfo.TrueName);
                            Session.Timeout = 40;
                            return(RedirectToAction("Index", "Window"));
                        }
                        else
                        {
                            return(RedirectToAction("Login", "Window"));
                        }
                    }
                }
                else
                {
                    return(RedirectToAction("Login", "Window"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Window"));
            }
        }
Esempio n. 10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.Company model)
 {
     return(dal.Update(model));
 }
Esempio n. 11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Maticsoft.Model.Company model)
 {
     return(dal.Add(model));
 }
Esempio n. 12
0
        /// <summary>
        /// 根据公司id和名称查找指定公司是否存在(不存在则添加并返回id)
        /// 判断是否存在试卷权限,不存在添加
        /// </summary>
        /// <param name="str_ID"></param>
        /// <param name="str_companyName"></param>
        /// <returns></returns>
        private bool GetCompany(string str_ID, string str_companyName)
        {
            string[] arr_paperID = { "122", "123", "125" };                           //试卷id

            Maticsoft.BLL.Company BCompany = new Maticsoft.BLL.Company();             //公司

            Maticsoft.BLL.PaperManage BPaperManage = new Maticsoft.BLL.PaperManage(); //试卷授权

            try
            {
                List <Maticsoft.Model.Company> listCompany = BCompany.GetModelList(" obj_ID=" + int.Parse(str_ID) + " AND Name='" + str_companyName + "' ");
                if (listCompany != null && listCompany.Count > 0)//该公司存在
                {
                    //判断有没有试卷授权
                    List <Maticsoft.Model.PaperManage> listPaperManage = BPaperManage.GetModelList(" CompanyID=" + listCompany[0].ID + " AND PaperID in(122,123,125)");
                    if (listPaperManage != null && listPaperManage.Count > 0)//该公司有试卷授权()
                    {
                        List <string> paperID = new List <string>();

                        for (int i = 0; i < listPaperManage.Count; i++)
                        {
                            paperID.Add(listPaperManage[i].PaperID.ToString());//将授权试卷id拿出来
                        }

                        List <string> list_paperID = new List <string>(); //保存没有授权试卷id
                                                                          //判断是否存在122,123,125这三份试卷
                        for (int i = 0; i < arr_paperID.Length; i++)
                        {
                            if (!paperID.Contains(arr_paperID[i]))//判断授权试卷中有没有122,123,125这三份试卷
                            {
                                list_paperID.Add(arr_paperID[i]);
                            }
                        }
                        if (list_paperID != null && list_paperID.Count > 0)//如果存在没有授权的则添加
                        {
                            for (int j = 0; j < list_paperID.Count; j++)
                            {
                                Maticsoft.Model.PaperManage MPaperManage = new Maticsoft.Model.PaperManage();
                                MPaperManage.PaperID        = int.Parse(list_paperID[j].ToString());
                                MPaperManage.CompanyID      = listCompany[0].ID;
                                MPaperManage.IsLongTime     = true;
                                MPaperManage.CreateDateTime = DateTime.Now;
                                MPaperManage.Title          = listCompany[0].Name + "授权";
                                MPaperManage.Num            = 100;
                                if (BPaperManage.Add(MPaperManage) <= 0)
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                    else//改公司没有试卷授权
                    {
                        for (int j = 0; j < arr_paperID.Length; j++)
                        {
                            Maticsoft.Model.PaperManage MPaperManage = new Maticsoft.Model.PaperManage();
                            MPaperManage.PaperID        = int.Parse(arr_paperID[j].ToString());
                            MPaperManage.CompanyID      = listCompany[0].ID;
                            MPaperManage.IsLongTime     = true;
                            MPaperManage.CreateDateTime = DateTime.Now;
                            MPaperManage.Title          = listCompany[0].Name + "授权";
                            MPaperManage.Num            = 100;
                            if (BPaperManage.Add(MPaperManage) <= 0)
                            {
                                return(false);
                            }
                        }
                    }
                }
                else//公司不存在(添加)
                {
                    Maticsoft.Model.Company MCompany = new Maticsoft.Model.Company();
                    MCompany.obj_ID     = int.Parse(str_ID);
                    MCompany.Name       = str_companyName;
                    MCompany.CreateTime = DateTime.Now;
                    int int_companyid = BCompany.Add(MCompany);
                    if (int_companyid > 0)//添加成功
                    {
                        //添加试卷授权
                        for (int j = 0; j < arr_paperID.Length; j++)
                        {
                            Maticsoft.Model.PaperManage MPaperManage = new Maticsoft.Model.PaperManage();
                            MPaperManage.PaperID        = int.Parse(arr_paperID[j].ToString());
                            MPaperManage.CompanyID      = int_companyid;
                            MPaperManage.IsLongTime     = true;
                            MPaperManage.CreateDateTime = DateTime.Now;
                            MPaperManage.Title          = str_companyName + "授权";
                            MPaperManage.Num            = 100;
                            if (BPaperManage.Add(MPaperManage) <= 0)
                            {
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                throw;
                //return false;
            }

            return(true);
        }