示例#1
0
        protected bool Save()
        {
            try
            {
                string bmbh   = TStar.Web.Globals.Account.DeptPkid;
                string dzbbh  = this.ddlDzbbh.SelectedValue;
                string gh     = this.tbxGh.Text.Trim();
                string xm     = this.tbxXm.Text.Trim();
                string sjhm   = this.tbxSjhm.Text.Trim();
                string errMsg = "";

                if (this.ddlDzbbh.SelectedValue == "__")
                {
                    errMsg += "请选择党支部名称 !\n";
                }
                if (String.IsNullOrEmpty(gh))
                {
                    errMsg += "请输入" + Title + "工号 !\n";
                }
                if (String.IsNullOrEmpty(xm))
                {
                    errMsg += "请输入" + Title + "姓名 !\n";
                }
                if (String.IsNullOrEmpty(sjhm))
                {
                    errMsg += "请输入手机号码 !\n";
                }
                else if (sjhm.Length < 11)
                {
                    errMsg += "手机号码不正确 !\n";
                }
                if (errMsg.Length > 0)
                {
                    Alert.Show(errMsg, "保存提示", MessageBoxIcon.Warning);
                    return(false);
                }

                Model.Jcgl.Jc_lxr m = new Model.Jcgl.Jc_lxr();
                m.Pkid  = Pkid;
                m.Bmbh  = bmbh;
                m.Dzbbh = dzbbh;
                m.Gh    = gh;
                m.Xm    = xm;
                m.Sjhm  = sjhm;
                m.Lbdm  = this.rblLb.SelectedValue;
                m.Issj  = this.rblSj.SelectedValue == "1";
                BLL.Jcgl.Jc_lxr.Save(m);

                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, "保存失败", MessageBoxIcon.Error);
                return(false);
            }
        }
示例#2
0
        protected bool Save()
        {
            try
            {
                string bmbh   = TStar.Web.Globals.Account.DeptPkid;
                string dzbbh  = Pkid;
                string uid    = this.tbxUid.Text.Trim();
                string pwd    = this.tbxPwd.Text.Trim();
                string pwd2   = this.tbxPwd2.Text.Trim();
                string errMsg = "";

                if (String.IsNullOrEmpty(uid))
                {
                    errMsg += "请输入登录用户名 !\n";
                }
                if (isNew)
                {
                    if (String.IsNullOrEmpty(pwd) || String.IsNullOrEmpty(pwd2))
                    {
                        errMsg += "请输入登录密码并确认 !\n";
                    }
                    else if (pwd != pwd2)
                    {
                        errMsg += "两次输入的密码不一致 !\n";
                    }
                }
                else if ((!String.IsNullOrEmpty(pwd) || !String.IsNullOrEmpty(pwd2)) && pwd != pwd2)
                {
                    errMsg += "两次输入的密码不一致 !\n";
                }
                if (errMsg.Length > 0)
                {
                    Alert.Show(errMsg, "保存提示", MessageBoxIcon.Warning);
                    return(false);
                }

                Model.Jcgl.Jc_lxr m = new Model.Jcgl.Jc_lxr();
                m.Pkid  = Pkid;// this.hfdPkid.Text;
                m.Bmbh  = bmbh;
                m.Dzbbh = this.ddlDzbbh.SelectedValue;
                m.Gh    = uid;
                m.Xm    = this.ddlDzbbh.SelectedItem.Text;
                m.Sjhm  = pwd;
                m.Lbdm  = "0";
                BLL.Jcgl.Jc_lxr.Save(m);
                //ShowNotify("保存成功 !");

                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, "保存失败", MessageBoxIcon.Error);
                return(false);
            }
        }
示例#3
0
文件: Jc_lxr.cs 项目: hzlloach/EPBMS
 public static bool Save(Model.Jcgl.Jc_lxr m)
 {
     if (string.IsNullOrEmpty(m.Pkid))
     {
         return(Insert(m));
     }
     else
     {
         return(Update(m));
     }
 }
示例#4
0
文件: Jc_lxr.cs 项目: hzlloach/EPBMS
 private static bool Update(Model.Jcgl.Jc_lxr m)
 {
     try
     {
         if (m.Lbdm == "0")
         {
             BLL.Account.ModDzb(m.Pkid, m.Gh, m.Sjhm);
         }
         else
         {
             BLL.Account.ModLxr(m.Pkid, m.Dzbbh, m.Gh, m.Xm, m.Sjhm, m.Issj);
         }
         int r = Update <Model.Jcgl.Jc_lxr>(m);
         BLL.Globals.SystemCode.RefreshDtJc_lxr();
         return(r > 0);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
示例#5
0
文件: Jc_lxr.cs 项目: hzlloach/EPBMS
 public static bool Insert(Model.Jcgl.Jc_lxr m)
 {
     try
     {
         if (m.Lbdm == "0") // 手机号码里存放初始登录密码
         {
             BLL.Account.AddDzb(m.Pkid, m.Bmbh, m.Dzbbh, m.Xm, m.Gh, m.Sjhm);
         }
         else
         {
             BLL.Account.AddLxr(m.Pkid, m.Bmbh, m.Dzbbh, m.Gh, m.Xm, m.Sjhm, m.Issj);
         }
         int r = Insert <Model.Jcgl.Jc_lxr>(m);
         BLL.Globals.SystemCode.RefreshDtJc_lxr();
         return(r > 0);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
示例#6
0
        public static bool Save(Model.Jcgl.Jd_dzb m)
        {
            int r = 0;

            try
            {
                if (String.IsNullOrEmpty(m.Pkid))
                {
                    m.Pkid = ("ZB" + Guid.NewGuid().ToString().Replace("-", "").ToUpper()).Substring(0, 32);
                    r      = BLL.Dmgl.Insert <Model.Jcgl.Jd_dzb>(m);

                    // 添加联系人及帐号
                    Model.Jcgl.Jc_lxr l = new Model.Jcgl.Jc_lxr();
                    l.Pkid  = m.Pkid;
                    l.Bmbh  = m.Bmbh;
                    l.Dzbbh = m.Pkid;
                    l.Gh    = m.UserID;
                    l.Xm    = m.Dzbmc;
                    l.Sjhm  = m.Password;
                    l.Lbdm  = "0";
                    Jc_lxr.Insert(l);
                }
                else
                {
                    r = BLL.Dmgl.Update <Model.Jcgl.Jd_dzb>(m);
                }
                return(r > 0);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("唯一") > 0)
                {
                    throw new Exception("党支部代码或名称已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
示例#7
0
        /// <summary>
        /// 依据传入参数TableName导入数据
        /// </summary>
        protected override int ImportData(DataRowView drv)
        {
            int cnt = 0;

            string[] columns = Columns, s;
            string   bmbh    = TStar.Web.Globals.Account.DeptPkid;
            string   dzbmc   = drv[columns[0]].ToString();

            if (string.IsNullOrEmpty(dzbmc))
            {
                throw new Exception("党支部名称为空。");
            }

            string dzbbh = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_dzb, "Bmbh='" + bmbh + "'", "Dzbmc", "Pkid", dzbmc, "");

            //Model.Jcgl.Jd_dzb dzb = BLL.Jcgl.Jd_dzb.GetEntity(bmbh, dzbmc);
            if (string.IsNullOrEmpty(dzbbh))
            {
                throw new Exception("该党支部信息不存在。");
            }

            string gh = drv[columns[1]].ToString();

            if (string.IsNullOrEmpty(gh))
            {
                throw new Exception("工号为空。");
            }

            string xm = drv[columns[2]].ToString();

            if (string.IsNullOrEmpty(xm))
            {
                throw new Exception("姓名为空。");
            }

            string sjhm = drv[columns[3]].ToString();

            if (string.IsNullOrEmpty(sjhm))
            {
                throw new Exception("手机号码为空。");
            }
            else if (sjhm.Length < 11)
            {
                throw new Exception("手机号码不正确。");
            }

            string lb = drv[columns[4]].ToString();

            if (string.IsNullOrEmpty(lb))
            {
                throw new Exception("角色类别为空。");
            }
            else if (lb != "教师" && lb != "学生")
            {
                throw new Exception("角色类别不正确。");
            }

            string sj = drv[columns[5]].ToString();

            if (!string.IsNullOrEmpty(sj) && sj != "是")
            {
                throw new Exception("支部书记不正确。");
            }

            Model.Jcgl.Jc_lxr m = new Model.Jcgl.Jc_lxr();
            m.Bmbh  = bmbh;
            m.Dzbbh = dzbbh;
            m.Gh    = gh;
            m.Xm    = xm;
            m.Sjhm  = sjhm;
            m.Lbdm  = lb == "教师" ? "1" : "2";
            m.Issj  = sj == "是";
            if (BLL.Jcgl.Jc_lxr.Save(m))
            {
                cnt        = 1;
                drv["Del"] = 1;
            }

            return(cnt);
        }