Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (uid == null)
            {
                Response.Redirect("../../LogInPage.aspx");
            }
            if (!IsPostBack)
            {
                try
                {
                    string text = null;

                    string[] temp = receiverid.Split(',');
                    for (int i = 0; i < temp.Length; i++)
                    {
                        int       personmemberid = Convert.ToInt32(temp[i]);
                        BasicInfo personinfo     = BasicInfoBusiness.GetBasicInfoById(personmemberid);
                        if (temp[i] != "" && personinfo != null)
                        {
                            text     += personinfo.Email + ",";
                            receiver += personinfo.Email + ",";
                        }
                    }
                    receiver = receiver.Substring(0, receiver.Length - 1);
                    this.Label_MessageTo.Text = text.Substring(0, text.Length - 1);
                }
                catch
                {
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (uid == null)
     {
         Response.Redirect("../../LogInPage.aspx");
     }
     if (!IsPostBack)
     {
         try
         {
             string   receiver_text = null;
             string[] temp          = receiverid.Split(',');
             for (int i = 0; i < temp.Length; i++)
             {
                 int       id         = Convert.ToInt32(temp[i]);
                 BasicInfo personinfo = BasicInfoBusiness.GetBasicInfoById(id);
                 if (personinfo.Phone != null && personinfo.Phone.ToString() != "")
                 {
                     receiver      += personinfo.Phone + ",";
                     receiver_text += personinfo.Phone + ",";
                 }
             }
             receiver        = receiver.Substring(0, receiver.Length - 1);
             this.tb_To.Text = receiver_text.Substring(0, receiver_text.Length - 1);
             //XF.ServiceReference3.MsgModemWebServerSoapClient com = new ServiceReference3.MsgModemWebServerSoapClient();
             //this.TB_Content.Text = com.GetComNum();
         }
         catch
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误')", true);
         }
     }
 }
Esempio n. 3
0
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            try
            {
                //TUserInfo u = BusinessSupply.BusinessOper.UserBusiness.GetUserById(Convert.ToInt32(uid));
                //int associationid = Convert.ToInt32(u.AssociationId.ToString());
                if (this.ddl_MemberJob.SelectedValue != "")
                {
                    //string job = this.ddl_MemberJob.SelectedValue;
                    //DataTable member = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPersonAssociationTableByAssociationAndJob(associationid, Convert.ToInt32(job));
                    //DataTable member = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPersonAssociationTableByJob(Convert.ToInt32(job));

                    DataTable dt = BasicInfoBusiness.GetBasicInfosForMessage();
                    this.CheckBoxList1.DataSource     = dt;
                    this.CheckBoxList1.DataTextField  = "Name";
                    this.CheckBoxList1.DataValueField = "Id";
                    this.CheckBoxList1.DataBind();
                    CheckCellphoneNum();
                    Session["ReceiverId"] = null;
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误!')", true);
            }
        }
Esempio n. 4
0
        protected void btn_Add_Click(object sender, EventArgs e)
        {
            string name    = tb_name.Text.Trim();
            string phone   = tb_phone.Text.Trim();
            string email   = tb_email.Text.Trim();
            string address = tb_address.Text.Trim();
            string zipcode = tb_zipcode.Text.Trim();
            bool   result  = false;

            if (basicInfoId != 0)//修改
            {
                result = BasicInfoBusiness.UpdateBasicInfo(basicInfoId, name, phone, email, address, zipcode);
                if (!result)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('修改失败,请重新再试!')", true);
                    return;
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('修改成功', 2, -1);close();", true);
            }
            else//新增
            {
                result = BasicInfoBusiness.AddBasicInfo(name, phone, email, address, zipcode);
                if (!result)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('新增失败,请重新再试!')", true);
                    return;
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('新增成功', 2, -1);close();", true);
            }
        }
Esempio n. 5
0
 //处理PersonMemberBasicInfo中Email字段无有效邮件地址的会员
 public void CheckEmailAddress()
 {
     for (int i = 0; i < CheckBoxList1.Items.Count; i++)
     {
         string    id = this.CheckBoxList1.Items[i].Value;
         DataTable personwithemail = new DataTable();
         personwithemail = BasicInfoBusiness.GetBasicInfoForHasEmailById(Convert.ToInt32(id));
         if (personwithemail.Rows.Count == 0)
         {
             this.CheckBoxList1.Items[i].Enabled = false;
         }
     }
 }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //DataTable dt_person = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPersonWithEmailByAssociationId(associationid);
                DataTable dt = BasicInfoBusiness.GetBasicInfosForEmail();

                this.CheckBoxList1.DataSource     = dt;
                this.CheckBoxList1.DataTextField  = "Name";
                this.CheckBoxList1.DataValueField = "Id";
                this.CheckBoxList1.DataBind();
                CheckEmailAddress();
                Session["ReceiverId"] = null;
            }
        }
Esempio n. 7
0
        protected void btn_OutPut_Click(object sender, EventArgs e)
        {
            try
            {
                string    personname = this.tb_PersonName.Text.Trim();
                DataTable dt_pa      = BasicInfoBusiness.GetBasicInfoDataTable(personname);

                string browser = Request.UserAgent.ToLower();
                //export.ExportClass("性别分类统计", "性别分类统计.xls", browser, statistical_xbfl);
                string tempPath = Server.MapPath("../Envelope1.xls");
                ExcelHelper1.ExportExcelForDtByNPOI_envelope(dt_pa, "信封贴.xls", tempPath, 1, "列表", browser);
            }
            catch
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误!')", true);
            }
        }
Esempio n. 8
0
 private void RefreshTable(int NewIndex)
 {
     try
     {
         int    size = this.gv_Member.PageSize;
         string name = tb_PersonName.Text.Trim();
         var    ps   = BasicInfoBusiness.GetBasicInfos(size, name, "", "");
         this.gv_Member.PageIndex  = NewIndex;
         this.gv_Member.DataSource = new PagedCollection <BasicInfo>(ps, NewIndex);
         this.gv_Member.DataBind();
         this.Label_ResultCount.Text = ps.GetResultCount().ToString();
     }
     catch
     {
         ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('数据加载错误!')", true);
     }
 }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //TUserInfo u = BusinessSupply.BusinessOper.UserBusiness.GetUserById(Convert.ToInt32(uid));
         //int associationid = Convert.ToInt32(u.AssociationId.ToString());
         ////DataTable dt_person = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPersonWithEmailByAssociationId(associationid);
         //DataTable dt_person = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPersonByAssociationId(associationid);
         //DataTable dt_person = BusinessSupply.BusinessOper.PersonAssociationBusiness.GetPerson();
         DataTable dt = BasicInfoBusiness.GetBasicInfosForMessage();
         this.CheckBoxList1.DataSource     = dt;
         this.CheckBoxList1.DataTextField  = "Name";
         this.CheckBoxList1.DataValueField = "Id";
         this.CheckBoxList1.DataBind();
         CheckCellphoneNum();
         Session["ReceiverId"] = null;
     }
 }
Esempio n. 10
0
        protected void gv_basicInfo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string command = e.CommandName;
            int    id      = Convert.ToInt32(e.CommandArgument);

            if (command.Equals("Upd"))//修改
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "btn_Add_jbxx_Click('添加基本信息','./BasicInfoManage_Add.aspx?BasicInfoId=" + id + "')", true);
            }
            else if (command.Equals("Del"))//删除
            {
                bool result = BasicInfoBusiness.DeleteBasicInfo(id);
                if (!result)
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('删除失败,请重新再试!')", true);
                    return;
                }
                RefreshView(0);
            }
        }
Esempio n. 11
0
 protected void btn_Search_Click(object sender, EventArgs e)
 {
     try
     {
         //if (this.ddl_MemberJob.SelectedValue != "")
         //{
         //string job = this.ddl_MemberJob.SelectedValue;
         DataTable dt = BasicInfoBusiness.GetBasicInfosForEmail();
         this.CheckBoxList1.DataSource     = dt;
         this.CheckBoxList1.DataTextField  = "Name";
         this.CheckBoxList1.DataValueField = "Id";
         this.CheckBoxList1.DataBind();
         CheckEmailAddress();
         Session["ReceiverId"] = null;
         //}
     }
     catch
     {
         ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误!')", true);
     }
 }
Esempio n. 12
0
        protected void btn_importEvent_Click(object sender, EventArgs e)
        {
            string fileExtension = null;
            string file          = import_upload.FileName.Replace(" ", "");
            string filename      = System.IO.Path.GetFileNameWithoutExtension(file) + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "").Replace("/", "").Replace(":", "").Replace("-", "");
            bool   fileOK        = false;
            string savepath      = Server.MapPath("~/Upload/DepartmentPlace/");

            //判断是否已选择上传文件
            if (import_upload.HasFile)
            {
                //获得文件后缀
                fileExtension = System.IO.Path.GetExtension(import_upload.FileName).ToLower();
                //允许上传文件后缀
                String[] allowedExtensions = { ".xls", ".xlsx" };
                //判断文件后缀是否被允许上传
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK    = true;
                        filename += fileExtension;
                    }
                }
                //文件类型合法
                if (fileOK)
                {
                    try
                    {
                        //long strLen = btn_upload.PostedFile.ContentLength;//字节
                        //if (strLen >= sizes)
                        //{
                        //    ScriptManager.RegisterStartupScript(UpdatePanel_basic, this.GetType(), "alter", "alert('上传照片不能大于5M!')", true);
                        //    return;
                        //}
                        if (!Directory.Exists(savepath))
                        {
                            Directory.CreateDirectory(savepath);
                        }
                        import_upload.PostedFile.SaveAs(savepath + filename);

                        DataTable     dt           = ReadExcelToTable(savepath + filename); //读取Excel文件(.xls和.xlsx格式)
                        int           success      = 0;
                        int           fail         = 0;
                        StringBuilder sb_failIndex = new StringBuilder();
                        string        errorInfo    = "。";
                        for (int i = 1; i < dt.Rows.Count; i++)
                        {
                            string name    = dt.Rows[i]["F1"].ToString();
                            string phone   = dt.Rows[i]["F2"].ToString();
                            string email   = dt.Rows[i]["F3"].ToString();
                            string address = dt.Rows[i]["F4"].ToString();
                            string zipcode = dt.Rows[i]["F5"].ToString();
                            if (name.IsNullOrEmpty() || (phone.IsNullOrEmpty() && email.IsNullOrEmpty()))
                            {
                                fail++;
                                sb_failIndex.Append((i + 1) + "." + name + "、");
                                continue;
                            }

                            if (BasicInfo.FindOne(CK.K["Name"] == name && CK.K["IsDelete"] == false) == null)
                            {
                                if (BasicInfoBusiness.AddBasicInfo(name, phone, email, address, zipcode))
                                {
                                    success++;
                                    continue;
                                }
                                else
                                {
                                    fail++;
                                    sb_failIndex.Append((i + 1) + "." + name + "、");
                                    continue;
                                }
                            }
                            else
                            {
                                fail++;
                                sb_failIndex.Append((i + 1) + "." + name + "、");
                                continue;
                            }
                        }
                        if (sb_failIndex.Length > 0)
                        {
                            sb_failIndex.Remove(sb_failIndex.Length - 1, 1);
                            errorInfo = ",失败excel序号(包含标题行)为:" + sb_failIndex.ToString();
                        }
                        RefreshView(0);
                        ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "提示", "layer.alert('" + "导入完成!总共" + (success + fail) + "条,其中成功导入" + success + "条,失败导入" + fail + "条" + errorInfo + "')", true);
                        return;
                    }
                    catch (Exception ex)
                    {
                        text(ex.ToString());
                        ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "提示", "layer.alert('无法上传!')", true);
                        return;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "提示", "layer.alert('未识别的文件类型!请使用.xls或.xlsx文件进行导入!')", true);
                    return;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "提示", "layer.alert('请选择文件!')", true);
                return;
            }
        }