Esempio n. 1
0
    //向当前用户的直接领导发送邮件提醒功能
    public static void SendMailToLeader(string title, string remark, string url)
    {
        string user1  = HttpContext.Current.User.Identity.Name;
        string leader = null;

        if (String.IsNullOrEmpty(user1) == false)
        {
            U_UserNameBU userBU = new U_UserNameBU();
            leader = userBU.GetDirLeader();
            userBU.Close();
        }

        if (leader != null)
        {
            ZX_EmailBu email1 = new ZX_EmailBu();
            Hashtable  ht     = new Hashtable();
            ht["time0"]  = System.DateTime.Now.ToString();
            ht["title"]  = title;
            ht["remark"] = remark;
            ht["from1"]  = user1;
            ht["to1"]    = leader;
            ht["back"]   = "1";
            ht["url"]    = url;

            email1.AddMail(ht);
            email1.Close();
        }
    }
Esempio n. 2
0
    //submit data
    protected void Button1_Click(object sender, EventArgs e)
    {
        Hashtable ht = new Hashtable();

        for (int i = 0; i < arr1.Length; i++)
        {
            ht.Add(arr1[i], Util.GetControlValue(this.depart.Parent.FindControl(arr1[i])));
        }

        U_UserNameBU user1  = new U_UserNameBU();
        bool         result = user1.EditUserData(Request["id"], ht);

        user1.Close();

        //更新其他读者的数据
        user1.SetOthersReaders(this.sname.Text, this.leader1.Text);
        if (result)
        {
            Response.Redirect("UserMng.aspx", true);
        }
        else
        {
            Util.alert(this.Page, "错误提示:修改数据错误!");
        }
    }
Esempio n. 3
0
    //提交数据
    protected void Button1_Click(object sender, EventArgs e)
    {
        Hashtable ht = new Hashtable();

        string[] arr1 = new string[] { "num", "sname", "depart", "job", "cell", "email", "leader" };
        for (int i = 0; i < arr1.Length; i++)
        {
            ht.Add(arr1[i], Util.GetControlValue(this.depart.Parent.FindControl(arr1[i])));
        }
        ht.Add("password", "1234");
        ht.Add("login", DateTime.Now.ToString());

        if (ht["sname"].ToString().Trim() == "" || ht["depart"].ToString().Trim() == "")
        {
            Util.alert(this.Page, "错误提示:【用户姓名】和【所在部门】栏目不能为空!");
        }
        else
        {
            U_UserNameBU user1  = new U_UserNameBU();
            bool         result = user1.InsertData(ht);
            user1.Close();
            if (result)
            {
                Response.Redirect("UserMng.aspx", true);
            }
            else
            {
                Util.alert(this.Page, "错误提示:插入数据失败,可能的原因是【" + ht["sname"].ToString() + "】已经存在!");
            }
        }
    }
Esempio n. 4
0
    private void SetUserList()
    {
        String depart1 = this.depart.SelectedValue;

        if (String.IsNullOrEmpty(depart1) == false)
        {
            U_UserNameBU bu1 = new U_UserNameBU();
            DataSet      ds1 = bu1.GetAllUserList(depart1);
            bu1.Close();

            if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
            {
                String oldValue = this.sname.SelectedValue;
                this.sname.Items.Clear();
                foreach (DataRow dr in ds1.Tables[0].Rows)
                {
                    ListItem list1 = new ListItem(dr["sname"].ToString(), dr["sname"].ToString());
                    this.sname.Items.Add(list1);
                }

                if (this.sname.Items.FindByValue(oldValue) != null)
                {
                    this.sname.SelectedValue = oldValue;
                }
            }
        }
    }
Esempio n. 5
0
    public void BindData()
    {
        U_UserNameBU user1 = new U_UserNameBU();

        U_DepartBU depart1 = new U_DepartBU();
        DataSet    ds1     = depart1.GetAllDepart();

        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            Label lab1 = this.DataList0.Parent.FindControl("Label" + i) as Label;
            if (lab1 != null && ds1.Tables[0].Rows[i]["depart"] != null &&
                ds1.Tables[0].Rows[i]["depart"].ToString() != "")
            {
                lab1.Text = ds1.Tables[0].Rows[i]["depart"].ToString();
                DataList datalist1 = this.DataList0.Parent.FindControl("DataList" + i) as DataList;
                if (datalist1 != null)
                {
                    DataSet ds2 = user1.GetUserByDepart(lab1.Text);
                    datalist1.DataSource = ds2;
                    datalist1.DataBind();

                    if (ds2 != null && ds2.Tables[0].Rows.Count >= 0)
                    {
                        lab1.Parent.FindControl("Div" + i).Visible = true;
                    }
                }
            }
        }
        depart1.Close();
        user1.Close();
    }
Esempio n. 6
0
    //绑定数据1
    private void BindData()
    {
        U_UserNameBU user1 = new U_UserNameBU();

        int totalRow = 0;
        int curpage  = 1;

        if (ViewState["curpage"] != null)
        {
            curpage = (int)ViewState["curpage"];
        }

        DataSet ds1 = user1.GetAllUserList(curpage, this.status1.SelectedValue, this.PageNavigator1.PageSize, out totalRow);

        this.GridView1.DataSource = ds1;
        this.GridView1.DataBind();
        user1.Close();

        this.PageNavigator1.TotalRows   = totalRow;
        this.PageNavigator1.CurrentPage = curpage;

        if (ds1.Tables[0].Rows.Count == 0 && curpage > 1)
        {
            ViewState["curpage"] = curpage - 1;
            this.BindData();
        }

        if (totalRow == 0)
        {
            this.PageNavigator1.Visible = false;
        }
    }
Esempio n. 7
0
    //得到我和我的下属信息
    private string GetMyDepartMen()
    {
        U_UserNameBU bu1    = new U_UserNameBU();
        string       result = bu1.GetSelfAndXiaShu(User.Identity.Name);

        bu1.Close();
        return(result);
    }
Esempio n. 8
0
    //删除数据
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string       id    = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        U_UserNameBU user1 = new U_UserNameBU();

        user1.DeleteUser(id);
        this.BindData(user1);
        user1.Close();
    }
Esempio n. 9
0
 //修改用户的登录密码
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         U_UserNameBU user1  = new U_UserNameBU();
         bool         result = user1.ModifyPass(this.pass1.Text, this.pass2.Text);
         user1.Close();
         if (result)
         {
             Util.alert(this.Page, "提示:修改密码成功,新密码下次登录起作用", true);
         }
         else
         {
             Util.alert(this.Page, "提示:修改密码失败,可能的原因是老密码输入不正确");
         }
     }
 }
Esempio n. 10
0
    //reset password
    protected void Button3_Click(object sender, EventArgs e)
    {
        Hashtable ht = new Hashtable();

        ht.Add("password", "1234");
        U_UserNameBU user1  = new U_UserNameBU();
        bool         result = user1.EditUserData(Request["id"], ht);

        user1.Close();
        if (result)
        {
            Comm.ShowInfo("提示:成功地重新设置登录密码为1234", Request.RawUrl);
        }
        else
        {
            Util.alert(this.Page, "提示:重新设置登录密码失败!");
        }
    }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Comm.SetAccess(User.Identity.Name, "资产管理员");

            if (Request["id"] == null || Request["id"] == "")
            {
                Response.Redirect("~/Error.aspx", true);
            }
            else
            {
                U_UserNameBU user1 = new U_UserNameBU();
                user1.SetZcZeren(this.zeren);
                user1.Close();
            }
        }
    }
Esempio n. 12
0
    //绑定人员
    protected void Repeater1_DataBound(object sender, RepeaterItemEventArgs e)
    {
        Label lab1 = e.Item.FindControl("labDepart") as Label;

        if (lab1 != null)
        {
            U_UserNameBU user1   = new U_UserNameBU();
            DataSet      Person1 = user1.GetAllUserList(lab1.Text);
            user1.Close();

            DataList datalist1 = e.Item.FindControl("DataListForPerson") as DataList;
            if (datalist1 != null)
            {
                datalist1.DataSource = Person1;
                datalist1.DataBind();
            }
            datalist1.Dispose();
        }
    }
Esempio n. 13
0
    //用户登录
    protected void btnCheck_Click()
    {
        U_UserNameBU user1  = new U_UserNameBU();
        bool         login1 = user1.Login(this.username.Text.Trim(), this.password.Text.Trim());

        user1.Close();
        if (login1 == false)
        {
            Util.alert(this.Page, "提示:用户名或密码不正确!");
        }
        else
        {
            Hashtable ht = (Hashtable)Application["OnLineUser"];
            ht[this.username.Text.Trim()] = this.username.Text.Trim();

            System.Web.Security.FormsAuthentication.SetAuthCookie(this.username.Text.Trim(), false);
            //FormsAuthentication.RedirectFromLoginPage(this.username.Text.Trim(), false);

            //写入用户登录日志(管理员忽略不写)
            if (this.username.Text.Trim() != "admin")
            {
                XT_UserLogBU logo1 = new XT_UserLogBU();
                logo1.AddLogo(this.username.Text.Trim());
                logo1.Close();
            }

            this.WirteLoginInfo(this.username.Text.Trim());


            //调整错误的数据
            this.RestoreErrorData();

            //进行数据的转向处理
            if (this.db.SelectedIndex == 0)  //转老资产管理数据库
            {
                Response.Redirect("~/zcdbWeb/default.aspx", true);
            }
            else                             //转联想资产管理数据库
            {
            }
        }
    }
Esempio n. 14
0
    //设置业务部门
    public static void SetDepart(ListControl drop1, string blankValue)
    {
        U_UserNameBU user1 = new U_UserNameBU();

        string[] arr = user1.GetZcJobDepart();
        if (arr != null)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                ListItem list1 = new ListItem(arr[i], arr[i]);
                drop1.Items.Add(list1);
            }
            if (blankValue != null && blankValue != "")
            {
                ListItem list1 = new ListItem(blankValue, "");
                drop1.Items.Insert(0, list1);
            }
        }
        user1.Close();
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //this.leader.Attributes["ReadOnly"] = "";
            if (Request["id"] != null)
            {
                U_DepartBU depart1 = new U_DepartBU();
                depart1.SetDepartList(this.depart, null);
                U_UserNameBU user1 = new U_UserNameBU();
                Hashtable    ht    = user1.GetDetailByID(Request["id"]);
                user1.Close();
                if (ht != null && ht.Count > 0)
                {
                    for (int i = 0; i < arr1.Length; i++)
                    {
                        if (ht[arr1[i]] == null)
                        {
                            ht[arr1[i]] = "";
                        }
                        Util.SetControlValue(this.sname.Parent.FindControl(arr1[i]), ht[arr1[i]]);
                    }
                }
                else
                {
                    Response.Redirect("~/Error.aspx?info=错误信息:此用户不存在!", true);
                }
            }
            else
            {
                Response.Redirect("~/Error.aspx", true);
            }


            if (this.sname.Text != String.Empty)
            {
                U_UserNameBU user1 = new U_UserNameBU();
                this.leader1.Text = user1.GetOtherReader(this.sname.Text.Trim());
            }
        }
    }
Esempio n. 16
0
    //将数据保存
    protected void btn1_Click(object sender, EventArgs e)
    {
        CommTable comm1 = new CommTable();

        comm1.TabName = "ZX_RCAP";

        //保存老的数据
        if (this.id.Value == "")
        {
            Hashtable ht = new Hashtable();
            ht["time0"] = DateTime.Now.ToString();
            ht["sname"] = User.Identity.Name;
            U_UserNameBU user1 = new U_UserNameBU();
            ht["depart"] = user1.GetDepart1(User.Identity.Name);
            user1.Close();

            ht["plantime"] = this.plantime.Text;
            ht["subject"]  = Util.GetMaxLenth(this.subject.Text, 90);
            ht["remark"]   = this.remark.Text;
            comm1.InsertData(ht);
        }
        else
        {
            string             infoid = this.id.Value;
            List <SearchField> list1  = new List <SearchField>();
            list1.Add(new SearchField("id", infoid, SearchFieldType.数值型));
            list1.Add(new SearchField("sname", User.Identity.Name));

            Hashtable ht = new Hashtable();
            ht["plantime"] = this.plantime.Text;
            ht["subject"]  = Util.GetMaxLenth(this.subject.Text, 90);
            ht["remark"]   = this.remark.Text;
            comm1.EditQuickData(list1, ht);
        }
        comm1.Close();
        Response.Redirect("MyRcaiPai.aspx", true);
    }
Esempio n. 17
0
    /// <summary>
    /// 统计方案数据
    /// </summary>
    /// <param name="time0"></param>
    /// <param name="time1"></param>
    /// <returns></returns>
    private DataSet GetTongJiData(String time0, String time1)
    {
        DataSet   ds0 = new DataSet();
        DataTable dt0 = new DataTable("Table0");

        ds0.Tables.Add(dt0);

        dt0.Columns.Add("depart");
        for (int i = 1; i <= 12; i++)
        {
            dt0.Columns.Add("num" + i);
        }

        List <SearchField> condition = new List <SearchField>();

        if (time0.Trim() != String.Empty)
        {
            condition.Add(new SearchField("shijian1", time0, SearchOperator.大于等于));
        }
        if (time1.Trim() != String.Empty)
        {
            condition.Add(new SearchField("shijian1", time1, SearchOperator.小于等于));
        }
        //设置查询范围
        U_RolesBU role1       = new U_RolesBU();
        bool      isAllCanSee = role1.isRole(new string[] { "公司领导", "评审部角色", "会计", "出纳", "领导秘书" });

        role1.Close();
        //1)公司领导、会计、出纳、领导秘书 可查询所有的项目
        if (isAllCanSee == false)
        {
            //普通的用户只能查询自己负责(或下属负责的项目)
            List <SearchField> condition1 = new List <SearchField>();
            U_UserNameBU       user1      = new U_UserNameBU();
            String             userName1  = user1.GetSelfAndXiaShu(User.Identity.Name);
            user1.Close();
            if (userName1 != String.Empty)
            {
                condition.Add(new SearchField("zeren", userName1, SearchOperator.集合));
            }
        }


        //2)统计新数据
        int[]     sum1    = new int[12];
        String    fdepart = "";
        CommTable comm1   = new CommTable();

        comm1.TabName = "U_ZC2";
        DataSet ds1 = comm1.SearchData("id,depart,status,spstatus,spkind", condition, "depart");
        DataRow dr1 = null;

        foreach (DataRow dr in ds1.Tables[0].Rows)
        {
            if (dr["depart"].ToString().Trim() != fdepart)
            {
                if (dr1 != null)
                {
                    ds0.Tables[0].Rows.Add(dr1);
                }
                //设置初值
                dr1           = ds0.Tables[0].NewRow();
                dr1["depart"] = dr["depart"];
                fdepart       = dr["depart"].ToString().Trim();
                for (int i = 1; i <= 12; i++)
                {
                    dr1["num" + i] = 0;
                }
            }

            //设置值
            String spstatus = dr["spstatus"].ToString().Trim();
            if (spstatus == "0")
            {
                dr1["num1"] = int.Parse(dr1["num1"].ToString()) + 1;
                sum1[0]    += 1;
            }
            else if (spstatus == "1")
            {
                dr1["num2"] = int.Parse(dr1["num2"].ToString()) + 1;
                dr1["num4"] = int.Parse(dr1["num4"].ToString()) + 1;
                sum1[1]    += 1;
                sum1[3]    += 1;
            }
            else if (spstatus == "2")
            {
                dr1["num3"] = int.Parse(dr1["num3"].ToString()) + 1;
                dr1["num4"] = int.Parse(dr1["num4"].ToString()) + 1;
                sum1[2]    += 1;
                sum1[3]    += 1;
            }

            String status = dr["status"].ToString().Trim();
            if (status == "21")
            {
                dr1["num5"]  = int.Parse(dr1["num5"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[4]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "22")
            {
                dr1["num6"]  = int.Parse(dr1["num6"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[5]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "23")
            {
                dr1["num7"]  = int.Parse(dr1["num7"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[6]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "24")
            {
                dr1["num8"]  = int.Parse(dr1["num8"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[7]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "25")
            {
                dr1["num9"]  = int.Parse(dr1["num9"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[8]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "26")
            {
                dr1["num10"] = int.Parse(dr1["num10"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[9]     += 1;
                sum1[11]    += 1;
            }
            else if (status == "27")
            {
                dr1["num11"] = int.Parse(dr1["num11"].ToString()) + 1;
                dr1["num12"] = int.Parse(dr1["num12"].ToString()) + 1;
                sum1[10]    += 1;
                sum1[11]    += 1;
            }
            else
            {
                ;
            }
        }

        if (dr1 != null)
        {
            ds0.Tables[0].Rows.Add(dr1);

            dr1           = ds0.Tables[0].NewRow();
            dr1["depart"] = "合计";
            for (int i = 1; i <= 12; i++)
            {
                dr1["num" + i] = sum1[i - 1];
            }
            ds0.Tables[0].Rows.Add(dr1);
        }
        comm1.Close();
        return(ds0);
    }
Esempio n. 18
0
    //用户登录
    protected void btnCheck_Click()
    {
        U_UserNameBU user1  = new U_UserNameBU();
        bool         login1 = user1.Login(this.username.Text.Trim(), this.password.Text.Trim());

        user1.Close();
        if (login1 == false)
        {
            Util.alert(this.Page, "提示:用户名或密码不正确!");
        }
        else
        {
            Hashtable ht = (Hashtable)Application["OnLineUser"];
            ht[this.username.Text.Trim()] = this.username.Text.Trim();

            //System.Web.Security.FormsAuthentication.SetAuthCookie(this.username.Text.Trim(), false);
            //FormsAuthentication.RedirectFromLoginPage(this.username.Text.Trim(), false);

            //设置登录信息
            //建立身份验证票对象
            FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, this.username.Text,
                                                                             DateTime.Now, DateTime.Today.AddDays(1), true, this.username.Text, "/");

            string     HashTicket = FormsAuthentication.Encrypt(Ticket); //加密序列化验证票为字符串
            HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);
            Response.Cookies.Add(UserCookie);                            //输出Cookie



            //写入用户登录日志(管理员忽略不写)
            if (this.username.Text.Trim() != "admin")
            {
                XT_UserLogBU logo1 = new XT_UserLogBU();
                logo1.AddLogo(this.username.Text.Trim());
                logo1.Close();
            }

            if (this.chk1.Checked)
            {
                WebFrame.Util.JCookie.SetCookieValue("myPassWord", this.password.Text);
            }
            else
            {
                WebFrame.Util.JCookie.SetCookieValue("myPassWord", "");
            }

            this.WirteLoginInfo(this.username.Text.Trim());


            //调整错误的数据
            this.RestoreErrorData();

            //进行数据的转向处理
            if (this.db.SelectedIndex == 0)  //转老资产管理数据库
            {
                Response.Redirect("default0.aspx", true);
            }
            else                             //转汉口银行资产管理数据库
            {
                String url1 = ConfigurationManager.AppSettings["hkbankurl"];
                url1 = url1 + Server.UrlEncode(this.username.Text);
                Response.Redirect(url1, true);
            }
        }
    }