示例#1
0
    public string GetType(int typeid)
    {
        string par = "";

        Tz888.Model.Mail.MailType model = mailtypebll.GetModel(typeid);
        par = model.TypeName.Trim();
        return(par);
    }
示例#2
0
 private void BindShow(int Id)
 {
     this.labTitle.Text = "邮件类型审核";
     Tz888.Model.Mail.MailType model = bll.GetModel(Id);
     txtName.Text       = model.TypeName.Trim();
     txtdesctption.Text = model.TypeRemark.Trim();
     showshenhes.Attributes.Add("style", "display:block");
     this.radiocaozuo.Items.FindByValue(model.Audit.ToString().Trim()).Selected = true;
 }
示例#3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Id == 0)
     {
         Tz888.Model.Mail.MailType model = new Tz888.Model.Mail.MailType();
         if (txtName.Text.Trim() == "")
         {
             Response.Write("<script>alert('请输入类型名称!')</script>");
             return;
         }
         model.TypeName   = txtName.Text.Trim();
         model.TypeRemark = txtdesctption.Text.Trim();
         model.Audit      = 1;
         int result = bll.Add(model);
         if (result > 0)
         {
             Response.Redirect("MailTypeManage.aspx");
         }
         else
         {
             Response.Write("<script>alert('已经存在该邮件类型!')</script>");
         }
     }
     else
     {
         Tz888.Model.Mail.MailType model = new Tz888.Model.Mail.MailType();
         if (txtName.Text.Trim() == "")
         {
             Response.Write("<script>alert('请输入类型名称!')</script>");
             return;
         }
         model.TypeName   = txtName.Text.Trim();
         model.TypeRemark = txtdesctption.Text.Trim();
         model.Audit      = Convert.ToInt32(this.radiocaozuo.SelectedValue);
         model.typeID     = Id;
         int result = bll.Update(model);
         if (result > 0)
         {
             Response.Redirect("MailTypeManage.aspx");
         }
         else
         {
             Response.Write("<script>alert('已经存在该类型名称,请重命名类型名称!')</script>");
         }
     }
 }
示例#4
0
    protected void btndaoru_Click(object sender, EventArgs e)
    {
        saveBPath = ConfigurationManager.AppSettings["upexcle"].ToString() + "MailInfo.xls";

        if (count == 1)
        {
            DataTable BdtExcel = ExcelToDataTable(saveBPath, "Sheet1");
            if (BdtExcel != null)
            {
                foreach (DataRow row in BdtExcel.Rows)
                {
                    string zhanghao  = row["账号"].ToString();
                    string UserNames = row["名称"].ToString();
                    string panyname  = row["公司名称"].ToString();
                    string dizhi     = row["地址"].ToString();
                    string wangzhi   = row["网址"].ToString();
                    string zhiwei    = row["职位"].ToString();
                    string type      = row["类型"].ToString();
                    string diyu      = row["地域"].ToString();
                    string xingye    = row["行业"].ToString();
                    string statu     = row["状态"].ToString();
                    string Mail      = row["邮件"].ToString();
                    string shouji    = row["手机"].ToString();
                    string zu        = row["组"].ToString();
                    string beizhu    = row["备注"].ToString();

                    string sd = row["时间"].ToString();

                    string sdasd = row["操作"].ToString();

                    Tz888.Model.Mail.Industry modelI = industrybll.GetModelByName(xingye);
                    Tz888.Model.Mail.MailInfo model  = new Tz888.Model.Mail.MailInfo();

                    string[] diyulist = diyu.Split(':');
                    if (diyulist.Length > 1)
                    {
                        Tz888.Model.Mail.Province modelp = provincebll.GetModelByName(diyulist[0].ToString().Trim());
                        Tz888.Model.Mail.City     modelc = citybll.GetModelByName(diyulist[1].ToString().Trim());
                        model.ProvinceId = Convert.ToInt32(modelp.Id);
                        model.CityId     = Convert.ToInt32(modelc.Id);
                    }
                    else
                    {
                        Tz888.Model.Mail.Province modelps = provincebll.GetModelByName(diyu.Trim());
                        model.ProvinceId = Convert.ToInt32(modelps.Id);
                        model.CityId     = 0;
                    }

                    model.LoginName = zhanghao;
                    model.UserName  = UserNames.Trim();
                    Tz888.Model.Mail.MailType modeltype = mailtypebll.GetModelByTypeName(type);
                    model.PanyName   = panyname.Trim();
                    model.PositionId = Convert.ToInt32(positionbll.GetModelByName(zhiwei.Trim()).Id);
                    model.Address    = dizhi.Trim();
                    model.LinkUrl    = wangzhi.Trim();

                    if (statu.Trim() == "未审核")
                    {
                        model.audit = 0;
                    }
                    else
                    {
                        model.audit = 1;
                    }
                    if (xingye.Trim() != "所有行业")
                    {
                        model.industry = Convert.ToInt32(industrybll.GetModelByName(xingye.Trim()).Id);
                    }
                    else
                    {
                        model.industry = -1;
                    }
                    model.Mial      = Mail.Trim();
                    model.Mobile    = shouji.Trim();
                    model.typeID    = Convert.ToInt32(modeltype.typeID);
                    model.groupID   = Convert.ToInt32(mialgroupbll.GetModelByName(zu.Trim()).groupID);
                    model.remark    = beizhu.Trim();
                    model.Mdatetime = sd;
                    int result = mailinfobll.Add(model);
                }
            }
            else
            {
                Response.Write("<script>alert('请上传的Excel表格!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('请上传的Excel表格!');</script>");
        }
        BindShow();
    }
示例#5
0
    protected void btnDaoChu_Click(object sender, EventArgs e)
    {
        List <Tz888.Model.Mail.MailInfo> list = mailinfobll.GetModelList(par);

        dt.Rows.Clear();
        foreach (Tz888.Model.Mail.MailInfo model in list)
        {
            DataRow dr = dt.NewRow();
            //单位名称  联系人 手机  电话  邮箱  类型 职位
            // dr["编号"] = model .UserID;
            //dr["账号"] = model.LoginName;
            dr["名称"]   = model.UserName;
            dr["公司名称"] = model.PanyName;
            Tz888.Model.Mail.Position modelpo = positionbll.GetModel(Convert.ToInt32(model.PositionId));
            if (modelpo != null)
            {
                dr["职位"] = modelpo.Name;
                //dr["地址"] = model.Address;
                //dr["网址"] = model.LinkUrl;
                Tz888.Model.Mail.MailType modeltype = mailtypebll.GetModel(Convert.ToInt32(model.typeID));
                string type = modeltype.TypeName.Trim();
                dr["类型"] = type;
                string diyu = "";
                Tz888.Model.Mail.Province modelp = provincebll.GetModel(Convert.ToInt32(model.ProvinceId));
                Tz888.Model.Mail.City     modelc = citybll.GetModel(Convert.ToInt32(model.CityId));
                if (modelc != null)
                {
                    diyu = modelp.Name + ": " + modelc.Name;
                }
                else
                {
                    diyu = modelp.Name;
                }
                // dr["地域"] = diyu;
                if (Convert.ToInt32(model.industry) != -1)
                {
                    Tz888.Model.Mail.Industry modelIndustry = industrybll.GetModel(Convert.ToInt32(model.industry));
                    string xingye = modelIndustry.Name.Trim();
                    //  dr["行业"] = xingye;
                }
                else   //dr["行业"] = "所有行业";
                {
                }
                // string statue = "";
                // if (model.audit == 0)
                //{
                //  statue = "未审核";
                //}
                //else { statue = "已审核"; }
                //dr["状态"] = statue;
                dr["邮件"] = model.Mial;
                dr["手机"] = model.Mobile;
                Tz888.Model.Mail.Mialgroup modelpr = mialgroupbll.GetModel(Convert.ToInt32(model.groupID));
                // dr["组"] = modelpr.groupname;
                // dr["备注"] = model.remark;
                //dr["时间"] = model.Mdatetime;
                //dr["操作"] = "";

                dt.Rows.Add(dr);
            }
        }

        HSSFWorkbook hssfworkbook      = new HSSFWorkbook();
        DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation();

        dsi.Company = "深圳拓富投资有限公司";
        SummaryInformation si = PropertySetFactory.CreateSummaryInformation();

        si.Subject = "邮件用户管理";
        si.Author  = "颜品庄";

        si.CreateDateTime = DateTime.Now;
        hssfworkbook.DocumentSummaryInformation = dsi;
        hssfworkbook.SummaryInformation         = si;

        HSSFSheet sheet1 = hssfworkbook.CreateSheet("Sheet1");
        //sheet1.DefaultColumnWidth=10;设置列宽
        HSSFRow row = sheet1.CreateRow(0);

        // row.CreateCell(0).SetCellValue("编号");
        // row.CreateCell(1).SetCellValue("账号");
        row.CreateCell(0).SetCellValue("名称");
        row.CreateCell(1).SetCellValue("公司名称");
        row.CreateCell(2).SetCellValue("职位");
        // row.CreateCell(5).SetCellValue("地址");
        //  row.CreateCell(6).SetCellValue("网址");
        row.CreateCell(3).SetCellValue("类型");
        // row.CreateCell(8).SetCellValue("地域");
        // row.CreateCell(9).SetCellValue("行业");
        // row.CreateCell(10).SetCellValue("状态");
        row.CreateCell(4).SetCellValue("邮件");
        row.CreateCell(5).SetCellValue("手机");
        // row.CreateCell(13).SetCellValue("组");
        //  row.CreateCell(14).SetCellValue("备注");
        //row.CreateCell(6).SetCellValue("时间");
        // row.CreateCell(16).SetCellValue("操作");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            HSSFRow row0 = sheet1.CreateRow(i + 1);
            // row0.CreateCell(0).SetCellValue(dt.Rows[i]["编号"].ToString());
            // row0.CreateCell(1).SetCellValue(dt.Rows[i]["账号"].ToString());
            row0.CreateCell(0).SetCellValue(dt.Rows[i]["名称"].ToString());
            row0.CreateCell(1).SetCellValue(dt.Rows[i]["公司名称"].ToString());
            row0.CreateCell(2).SetCellValue(dt.Rows[i]["职位"].ToString());
            //row0.CreateCell(5).SetCellValue(dt.Rows[i]["地址"].ToString());
            //row0.CreateCell(6).SetCellValue(dt.Rows[i]["网址"].ToString());
            row0.CreateCell(3).SetCellValue(dt.Rows[i]["类型"].ToString());
            //row0.CreateCell(8).SetCellValue(dt.Rows[i]["地域"].ToString());
            //row0.CreateCell(9).SetCellValue(dt.Rows[i]["行业"].ToString());
            //row0.CreateCell(10).SetCellValue(dt.Rows[i]["状态"].ToString());
            row0.CreateCell(4).SetCellValue(dt.Rows[i]["邮件"].ToString());
            row0.CreateCell(5).SetCellValue(dt.Rows[i]["手机"].ToString());
            //row0.CreateCell(13).SetCellValue(dt.Rows[i]["组"].ToString());
            //row0.CreateCell(14).SetCellValue(dt.Rows[i]["备注"].ToString());
            //row0.CreateCell(15).SetCellValue(dt.Rows[i]["时间"].ToString());
            // row0.CreateCell(6).SetCellValue(dt.Rows[i]["操作"].ToString());
        }
        string t1 = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString();

        string filename = "attachment;filename=" + System.Web.HttpUtility.UrlEncode("邮件用户表" + t1, System.Text.Encoding.UTF8) + ".xls";

        Response.ContentType = "application/vnd.ms-excel";
        //Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", filename));
        Response.AppendHeader("Content-Disposition", filename);
        Response.Clear();

        //Write the stream data of workbook to the root directory
        MemoryStream filestream = new MemoryStream();

        hssfworkbook.Write(filestream);

        Response.BinaryWrite(filestream.GetBuffer());
        Response.End();
    }