public static BG_Department GetBG_DepartmentByFaDepID(int depID)
        {
            string sql = "SELECT * FROM BG_Department WHERE FaDepID = @FaDepID";

            try
            {
                SqlParameter para = new SqlParameter("@DepID", depID);
                DataTable    dt   = DBUnity.AdapterToTab(sql, para);

                if (dt.Rows.Count > 0)
                {
                    BG_Department bG_Department = new BG_Department();

                    bG_Department.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_Department.DepLev  = dt.Rows[0]["DepLev"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepLev"];
                    bG_Department.FaDepID = dt.Rows[0]["FaDepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["FaDepID"];
                    bG_Department.DepCode = dt.Rows[0]["DepCode"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepCode"];
                    bG_Department.DepName = dt.Rows[0]["DepName"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepName"];
                    bG_Department.DepQua  = dt.Rows[0]["DepQua"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepQua"];
                    bG_Department.DepSta  = dt.Rows[0]["DepSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepSta"];
                    bG_Department.DepRem  = dt.Rows[0]["DepRem"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepRem"];

                    return(bG_Department);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
    protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string usname = txtUer.Text;
        string pwd    = txtPwd.Text;


        BG_User user = BG_UserLogic.UserLogin(usname, pwd);

        if (user != null)
        {
            Session[Constant.UserID]   = user.UserID;       //用户ID
            Session[Constant.UserName] = user.UserName;     //用户名称
            Session[Constant.UserNum]  = user.UserNum;      //用户工号
            Session[Constant.UserLim]  = user.UserLim;      //用户权限
            Session[Constant.DepID]    = user.DepID;        //用户所属部门ID
            BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
            Session[Constant.DepName] = department.DepName; //用户所属部门名称


            Response.Redirect("default.aspx", true);
        }
        else
        {
            X.Msg.Alert("Error", "密码或帐户名错误!").Show();
        }
    }
Exemple #3
0
        /// <summary>
        /// 根据部门ID查询一条记录
        /// </summary>
        /// <param name="depid">部门ID</param>
        /// <returns>BGDepartment</returns>
        public static BG_Department GetDepBydepid(string depid)
        {
            BG_Department dep = new BG_Department();

            try
            {
                string sqlStr = "select * from BG_Department where DepID='{0}'";
                sqlStr = string.Format(sqlStr, depid);
                DataTable dt = DBUnity.AdapterToTab(sqlStr);
                if (dt.Rows.Count > 0)
                {
                    dep.DepID   = (int)dt.Rows[0]["DepID"];
                    dep.DepLev  = (int)dt.Rows[0]["DepLev"];
                    dep.FaDepID = (int)dt.Rows[0]["FaDepID"];
                    dep.DepCode = dt.Rows[0]["DepCode"].ToString();
                    dep.DepName = dt.Rows[0]["DepName"].ToString();
                    dep.DepQua  = dt.Rows[0]["DepQua"].ToString();
                    dep.DepSta  = dt.Rows[0]["DepSta"].ToString();
                    dep.DepRem  = dt.Rows[0]["DepRem"].ToString();
                }
            }
            catch (Exception ex)
            {
                dep = new BG_Department();
                Log.WriteLog(ex.Message, "BGDepartmentService--GetDepBydepid");
            }
            return(dep);
        }
    //protected void btnLogin_Click(object sender, DirectEventArgs e)
    //{
    //    string usname = TextBox1.Text;
    //    string pwd = TextBox1.Text;


    //    BG_User user = BG_UserLogic.UserLogin(usname, pwd);
    //    if (user != null)
    //    {
    //        Session[Constant.UserID] = user.UserID;         //用户ID
    //        Session[Constant.UserName] = user.UserName;     //用户名称
    //        Session[Constant.UserNum] = user.UserNum;       //用户工号
    //        Session[Constant.UserLim] = user.UserLim;       //用户权限
    //        Session[Constant.DepID] = user.DepID;           //用户所属部门ID
    //        BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
    //        Session[Constant.DepName] = department.DepName; //用户所属部门名称


    //        Response.Redirect("default.aspx", true);
    //    }
    //    else
    //    {
    //        X.Msg.Alert("Error", "密码或帐户名错误!").Show();

    //    }
    //}

    protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string usname = txtUer.Text;
        string pwd    = txtPwd.Text;


        BG_User user = BG_UserLogic.UserLogin(usname, pwd);

        if (user != null)
        {
            Session[Constant.UserID]   = user.UserID;       //用户ID
            Session[Constant.UserName] = user.UserName;     //用户名称
            Session[Constant.UserNum]  = user.UserNum;      //用户工号
            Session[Constant.UserLim]  = user.UserLim;      //用户权限
            Session[Constant.DepID]    = user.DepID;        //用户所属部门ID
            BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
            Session[Constant.DepName] = department.DepName; //用户所属部门名称
            Session["CurrentYear"]    = BG_SysSettingLogic.GetLastYear();
            Session["IsLogin"]        = 1;
            BG_User userd = new BG_User();
            user.IsLogin = 1;
            BG_UserManager.ModifyBG_User(userd);
            Session[Constant.listallocationstr] = GetXML().Trim();
            Response.Redirect("default.aspx", true);
        }
        else
        {
            X.Msg.Alert("Error", "密码或帐户名错误!").Show();
        }
    }
Exemple #5
0
        /// <summary>
        /// 添加一条部门记录
        /// </summary>
        /// <param name="dep">一个部门实例</param>
        /// <returns>bool</returns>
        public static bool AddDep(BG_Department dep)
        {
            bool   falg   = false;
            string sqlStr = @"insert into BG_Department(DepLev,DepCode,DepName,DepQua,DepSta,DepRem,FaDepID) values 
                (@DepLev,@DepCode,@DepName,@DepQua,@DepSta,@DepRem, @FaDepID)";

            try
            {
                SqlParameter[] pars = new SqlParameter[] {
                    new SqlParameter("@DepLev", dep.DepLev),
                    new SqlParameter("@DepCode", dep.DepCode),
                    new SqlParameter("@DepName", dep.DepName),
                    new SqlParameter("@DepQua", dep.DepQua),
                    new SqlParameter("@DepSta", dep.DepSta),
                    new SqlParameter("@DepRem", dep.DepRem),
                    new SqlParameter("@FaDepID", dep.FaDepID)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, pars) > 0;
            }
            catch (Exception ex)
            {
                falg = false;
                Log.WriteLog(ex.Message, "BGDepartmentService--AddDep");
            }
            return(falg);
        }
Exemple #6
0
        /// <summary>
        /// 修改一条部门记录
        /// </summary>
        /// <param name="dep">部门ID</param>
        /// <returns>bool</returns>
        public static bool UpdDpe(BG_Department dep)
        {
            bool falg = false;

            try
            {
                string         sqlStr = @"update BG_Department set DepLev=@DepLev,FaDepID=@FaDepID,DepCode=@DepCode,
DepName=@DepName,DepQua=@DepQua,DepSta=@DepSta,DepRem=@DepRem where DepID=@DepID";
                SqlParameter[] pars   = new SqlParameter[] {
                    new SqlParameter("@DepID", dep.DepID),
                    new SqlParameter("@DepLev", dep.DepLev),
                    new SqlParameter("@FaDepID", dep.FaDepID),
                    new SqlParameter("@DepCode", dep.DepCode),
                    new SqlParameter("@DepName", dep.DepName),
                    new SqlParameter("@DepQua", dep.DepQua),
                    new SqlParameter("@DepSta", dep.DepSta),
                    new SqlParameter("@DepRem", dep.DepRem)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, pars) > 0;
            }
            catch (Exception ex)
            {
                falg = false;
                Log.WriteLog(ex.Message, "BGDepartmentService--UpdDpe");
            }
            return(falg);
        }
        public static BG_Department AddBG_Department(BG_Department bG_Department)
        {
            string sql =
                "INSERT BG_Department (DepLev, FaDepID, DepCode, DepName, DepQua, DepSta, DepRem)" +
                "VALUES (@DepLev, @FaDepID, @DepCode, @DepName, @DepQua, @DepSta, @DepRem)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@DepLev", bG_Department.DepLev),
                    new SqlParameter("@FaDepID", bG_Department.FaDepID),
                    new SqlParameter("@DepCode", bG_Department.DepCode),
                    new SqlParameter("@DepName", bG_Department.DepName),
                    new SqlParameter("@DepQua", bG_Department.DepQua),
                    new SqlParameter("@DepSta", bG_Department.DepSta),
                    new SqlParameter("@DepRem", bG_Department.DepRem)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_DepartmentByDepID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
    public void ModifyDepartment(string depID)
    {
        int           DepID = StrToInt(depID);
        BG_Department dp    = BG_DepartmentManager.GetBG_DepartmentByDepID(DepID);

        hiddepid.Text  = DepID.ToString();
        txtEDName.Text = dp.DepName.ToString();
        if (dp.DepRem == null)
        {
            txtEDDes.Text = null;
        }
        txtEDDes.Text = dp.DepRem.ToString();
        WinEdit.Show();
    }
        public static bool ModifyBG_Department(BG_Department bG_Department)
        {
            string sql =
                "UPDATE BG_Department " +
                "SET " +
                "DepLev = @DepLev, " +
                "FaDepID = @FaDepID, " +
                "DepCode = @DepCode, " +
                "DepName = @DepName, " +
                "DepQua = @DepQua, " +
                "DepSta = @DepSta, " +
                "DepRem = @DepRem " +
                "WHERE DepID = @DepID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@DepID", bG_Department.DepID),
                    new SqlParameter("@DepLev", bG_Department.DepLev),
                    new SqlParameter("@FaDepID", bG_Department.FaDepID),
                    new SqlParameter("@DepCode", bG_Department.DepCode),
                    new SqlParameter("@DepName", bG_Department.DepName),
                    new SqlParameter("@DepQua", bG_Department.DepQua),
                    new SqlParameter("@DepSta", bG_Department.DepSta),
                    new SqlParameter("@DepRem", bG_Department.DepRem)
                };

                int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para);
                if (t > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
    protected void btnMod_DirectClick(object sender, DirectEventArgs e)
    {
        BG_Department dp = BG_DepartmentManager.GetBG_DepartmentByDepID(StrToInt(hiddepid.Text));

        if (BG_DepartmentLogic.GetBG_DepartmentByName(AdName.Text.Trim()) != null)
        {
            X.Msg.Alert("提示", "部门名称重复,请重新填写.").Show();
            return;
        }
        dp.DepName = txtEDName.Text.Trim().Replace(",", string.Empty).Replace(",", string.Empty);
        dp.DepRem  = txtEDDes.Text.Trim().Replace(",", string.Empty).Replace(",", string.Empty);
        BG_DepartmentManager.ModifyBG_Department(dp);
        txtEDName.Clear();
        hiddepid.Clear();
        txtEDDes.Clear();
        DtDataBind();
        reset.Reset();
        WinEdit.Close();
    }
Exemple #11
0
        /// <summary>
        /// 更改部门状态(正常/禁用)
        /// </summary>
        /// <param name="depid">DepID</param>
        /// <returns>bool</returns>
        public static bool UpdDepSta(BG_Department depid)
        {
            bool falg = false;

            try
            {
                string         sqlStr = "update BG_Department set DepSta=@DepSta where DepID=@DepID";
                SqlParameter[] pars   = new SqlParameter[] {
                    new SqlParameter("@DepID", depid.DepID),
                    new SqlParameter("@DepSta", depid.DepSta)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, pars) > 0;
            }
            catch (Exception ex)
            {
                falg = false;
                Log.WriteLog(ex.Message, "BGDepartmentService--UpdDepSta");
            }
            return(falg);
        }
 protected void btnWinAdd_DirectClick(object sender, DirectEventArgs e)
 {
     if (AdName.Text != null)
     {
         if (BG_DepartmentLogic.GetBG_DepartmentByName(AdName.Text.Trim()) != null)
         {
             X.Msg.Alert("提示", "部门名称重复,请重新填写.").Show();
             return;
         }
         BG_Department dp = new BG_Department();
         dp.DepName = AdName.Text.ToString();
         dp.DepRem  = AdDes.Text.ToString();
         dp.FaDepID = AreaDepID;
         dp.DepLev  = 4;
         BG_DepartmentManager.AddBG_Department(dp);
         DtDataBind();
         resetform.Reset();
     }
     else
     {
         X.Msg.Alert("提示", "部门为必填项").Show();
     }
 }
 /// <summary>
 /// 修改一条部门记录
 /// </summary>
 /// <param name="dep">部门ID</param>
 /// <returns>bool</returns>
 public static bool UpdDpe(BG_Department dep)
 {
     return(BGDepartmentService.UpdDpe(dep));
 }
 /// <summary>
 /// 添加一条部门记录
 /// </summary>
 /// <param name="dep">一个部门实例</param>
 /// <returns>bool</returns>
 public static bool AddDep(BG_Department dep)
 {
     return(BGDepartmentService.AddDep(dep));
 }
 public static BG_Department AddBG_Department(BG_Department bG_Department)
 {
     return(BG_DepartmentService.AddBG_Department(bG_Department));
 }
Exemple #16
0
    public void Memberselect(string uid)
    {
        uid = uid.Contains("用户")?uid.Replace("用户", ""):uid;
        //FieldSet2.Hidden = !Radio4.Checked;
        TextField1.ReadOnly   = true;
        Session["TextField1"] = 0;
        if (uid.Length <= 0)
        {
            return;
        }
        hidUserID.Value = uid;
        chkClear();
        int     id   = StrToInt(uid);
        BG_User user = BG_UserManager.GetBG_UserByUserID(id);

        //BG_User user = BG_UserManager.GetBG_UserByUsid(id);
        if (user != null)
        {
            TextField1.Text = user.UserName;
            int depid = user.DepID;
            TextField3.Text = user.UserNum;
            TextField4.Text = user.UserIDNum;
            txtRem.Text     = user.UserRem;
            UserID.Text     = user.UserID.ToString();
            string limit = user.UserLim;
            if (common.IntSafeConvert(user.IsVIP.ToString().Substring(0, 1)) == 1)
            {
                Radio7.Checked = true;
            }
            else if (common.IntSafeConvert(user.IsVIP.ToString().Substring(0, 1)) == 0)
            {
                Radio8.Checked = true;
            }
            //else
            //{
            //    Radio19.Checked = true;
            //}
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(0, 1) == "1")
            {
                Radio9.Checked = true;
            }
            else
            {
                Radio9.Checked = false;
            }
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(1, 1) == "1")
            {
                Radio10.Checked = true;
            }
            else
            {
                Radio10.Checked = false;
            }
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(2, 1) == "1")
            {
                Radio11.Checked = true;
            }
            else
            {
                Radio11.Checked = false;
            }
            if (limit.Length >= 5)
            {
                if (limit.Substring(0, 1) == "1")
                {
                    Radio1.Checked = true;
                }
                if (limit.Substring(1, 1) == "1")
                {
                    Radio2.Checked = true;
                }
                if (limit.Substring(2, 1) == "1")
                {
                    Radio3.Checked = true;
                }
                if (limit.Substring(3, 1) == "1")
                {
                    Radio4.Checked = true;
                }
                if (limit.Substring(4, 1) == "1")
                {
                    Radio5.Checked = true;
                }
                if (limit.Substring(5, 1) == "1")
                {
                    Radio6.Checked = true;
                }
            }

            BG_Department dp = BG_DepartmentManager.GetBG_DepartmentByDepID(depid);
            if (dp != null)
            {
                //ComboBox1.RawValue = dp.DepName;
                ComboBox1.Text = dp.DepName;
                if (dp.DepName.Contains("局长基金"))
                {
                    Radio11.Enable(true);
                }
                else
                {
                    Radio11.Disable(true);
                }
            }
        }
    }
 /// <summary>
 /// 更改部门状态(正常/禁用)
 /// </summary>
 /// <param name="depid">DepID</param>
 /// <returns>bool</returns>
 public static bool UpdDepSta(BG_Department depid)
 {
     return(BG_DepartmentService.ModifyBG_Department(depid));
 }
 public static bool ModifyBG_Department(BG_Department bG_Department)
 {
     return(BG_DepartmentService.ModifyBG_Department(bG_Department));
 }
 public static bool DeleteBG_Department(BG_Department bG_Department)
 {
     return(BG_DepartmentService.DeleteBG_Department(bG_Department));
 }
 public static bool DeleteBG_Department(BG_Department bG_Department)
 {
     return(DeleteBG_DepartmentByDepID(bG_Department.DepID));
 }