protected void btnAddGroupBuy_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodstuan addTuan = new goodstuan(); addTuan.title = txtTitle.Value; addTuan.content = SearchDataClass.CheckStr(txtFckContent.Value); addTuan.starttime = Convert.ToDateTime(txtTimeSelect.Value.Split('-')[0]); var endtime = txtTimeSelect.Value.Split('-')[1] + " 23:59:59"; addTuan.endtime = Convert.ToDateTime(endtime); addTuan.validate = Convert.ToChar(drpValidate.SelectedValue); addTuan.setindex = Convert.ToChar(drpSetIndex.SelectedValue); addTuan.quantity = int.Parse(txtQuantily.Value); addTuan.price = Convert.ToDecimal(txtGoodsPrice.Value); addTuan.costprice = Convert.ToDecimal(txtGoodsCost.Value); addTuan.weight = txtWeight.Value.ToString(); //addTuan.community = int.Parse(drpCommunity.SelectedValue); //addTuan.shopid = int.Parse(drpShop.SelectedValue); addTuan.batch = txtGroupNum.Value; addTuan.img = HFurl.Value; addTuan.imgtwo = HFurl1.Value; addTuan.groupsort = int.Parse(drpGoodsSort.SelectedValue); addTuan.groupsortimg = HFurl2.Value.Trim(); addTuan.tuansummary = txtSummary.Value; addTuan.tuansummary1 = txtSummary1.Value; addTuan.tuansummary2 = txtSummary2.Value; addTuan.addtime = DateTime.Now; addTuan.selectytsort = Convert.ToChar(drpSaleGoodsSort.SelectedValue); addTuan.goodscode = txtGoodsCode.Value; addTuan.getgoodpoint = int.Parse(txtGetGoodPoint.Value); db.goodstuan.InsertOnSubmit(addTuan); db.SubmitChanges(); } Response.Redirect("GroupBuyManager.aspx?mid=" + Request["mid"] + "&type=" + Request["type"]); }
protected void btnExportExcel_ServerClick(object sender, EventArgs e) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { var timeSearch = string.Empty; if (string.IsNullOrEmpty(txtTimeSelect.Value.Trim())) { timeSearch = "NowMonth"; } else { timeSearch = txtTimeSelect.Value.Trim(); } var getFenXiaoExtractData = SearchDataClass.ExportFenXiaoExtractInfoData(timeSearch); //创建一个workbookdesigner对象 WorkbookDesigner designer = new WorkbookDesigner(); //制定报表模板 designer.Open(Server.MapPath(@"model\FenXiaoExtractList.xls")); //设置实体类对象 designer.SetDataSource("Export", getFenXiaoExtractData); //根据数据源处理生成报表内容 designer.Process(); //客户端保存的文件名 string fileName = HttpUtility.UrlEncode("月分销提成金额报表统计导出") + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; designer.Save(fileName, SaveType.OpenInExcel, FileFormatType.Excel2003, Response); Response.Flush(); Response.Close(); designer = null; Response.End(); } }
protected void btnAddNotices_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { notices addNot = new notices(); addNot.title = SearchDataClass.CheckStr(txtTitle.Value.Trim());; addNot.content = txtFckContent.Value; // SearchDataClass.CheckStr(txtFckContent.Value); //addNot.validate = Convert.ToChar(drpValidate.SelectedValue); //addNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); addNot.newssort = int.Parse(drpNewsSort.SelectedValue); addNot.img = HFurl.Value.Trim(); addNot.img1 = HFurl1.Value.Trim(); addNot.img2 = HFurl2.Value.Trim(); addNot.newssource = txtSource.Value.Trim(); addNot.likenum = 0; addNot.discussnum = 0; addNot.browses = 0; addNot.addtime = DateTime.Now; db.notices.InsertOnSubmit(addNot); db.SubmitChanges(); } Response.Redirect("NewsNoticesManager.aspx?mid=" + Request["mid"]); }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { plantdoctor getNot = db.plantdoctor.Single(x => x.Id == int.Parse(strUpid)); txtTitle.Value = getNot.title; txtFckContent.Value = SearchDataClass.CheckStr(getNot.content); drpValidate.SelectedValue = getNot.validate.ToString(); drpSetIndex.SelectedValue = getNot.setindex.ToString(); this.drpPlantDoctorSort.SelectedValue = getNot.plantdoctorsort.ToString(); this.hfDel.Value = getNot.img; this.HFurl.Value = getNot.img; if (!string.IsNullOrEmpty(getNot.img)) { this.iShowPhoto.Src = getNot.img; } else { this.iShowPhoto.Src = "assets/images/nophoto.gif"; } //db.SubmitChanges(); } } } }
protected void btnExportExcel_ServerClick(object sender, EventArgs e) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { //var timeSearch = string.Empty; //if (string.IsNullOrEmpty(txtTimeSelect.Value.Trim())) //{ // timeSearch = "NowMonth"; //} //else //{ // timeSearch = txtTimeSelect.Value.Trim(); //} var getMemberExtractData = SearchDataClass.GetSearchSaleCheckData(drpShopSet.SelectedValue, txtTimeSelect.Value.Trim()); //创建一个workbookdesigner对象 WorkbookDesigner designer = new WorkbookDesigner(); //制定报表模板 designer.Open(Server.MapPath(@"model\cocheckreport.xls")); //设置实体类对象 designer.SetDataSource("Export", getMemberExtractData); //根据数据源处理生成报表内容 designer.Process(); //客户端保存的文件名 string fileName = HttpUtility.UrlEncode("厂家核对报表导出") + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; designer.Save(fileName, SaveType.OpenInExcel, FileFormatType.Excel2003, Response); Response.Flush(); Response.Close(); designer = null; Response.End(); } }
protected void btnUpdatePlantDoctor_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["upid"])) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(Request["upid"]) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { plantdoctor upNot = db.plantdoctor.Single(x => x.Id == int.Parse(Request["upid"])); upNot.title = txtTitle.Value.Trim(); upNot.content = SearchDataClass.CheckStr(txtFckContent.Value); upNot.validate = Convert.ToChar(drpValidate.SelectedValue); upNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); upNot.plantdoctorsort = int.Parse(drpPlantDoctorSort.SelectedValue); if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.img = HFurl.Value.Trim(); } upNot.addtime = DateTime.Now; db.SubmitChanges(); } } Response.Redirect("PlantDoctorManager.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { spClientName.InnerHtml = "【" + Server.UrlDecode(getCookies["ClientName"].ToString()) + "】 Welcome To 益生联盟数据平台"; string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; var hour = string.Empty; if (DateTime.Now.Hour > 12) { hour = "下午" + DateTime.Now.Hour + "\n时"; } else { hour = "上午" + DateTime.Now.Hour + "\n时"; } spNowTime.InnerText = DateTime.Now.ToString("yyyy年MM月dd日") + "\n" + Day[Convert.ToInt16(DateTime.Now.DayOfWeek)] + "\n" + hour;; using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { var getSoStatus = from p in db.goodssort select new { p.sortId, p.sortName, p.sortFatherId, p.sortPath }; if (getSoStatus.Count() <= 0) { goodssort insert = new goodssort { sortName = "无上级分类", sortFatherId = -1, sortPath = "-1", addTime = DateTime.Now }; db.goodssort.InsertOnSubmit(insert); db.SubmitChanges(); } DataTable dtSort = SearchDataClass.ToDataTable(getSoStatus); //添加根目录 DataRow[] drs = dtSort.Select("sortFatherId=-1"); for (var i = 0; i < drs.Length; i++) { string nodeid = drs[i]["sortId"].ToString(); string text = drs[i]["sortName"].ToString(); text = "╋" + text; this.drpGoodstSort.Items.Add(new ListItem(text, nodeid)); this.drpEditGoodstSort.Items.Add(new ListItem(text, nodeid)); int sonparentid = int.Parse(nodeid); SearchDataClass.addOtherDll("", sonparentid, dtSort, 1, drpGoodstSort); SearchDataClass.addOtherDll("", sonparentid, dtSort, 1, drpEditGoodstSort); } drpGoodstSort.DataBind(); drpGoodstSort.Items.Insert(0, new ListItem("-请选择商品类型-")); drpEditGoodstSort.DataBind(); drpEditGoodstSort.Items.Insert(0, new ListItem("-请选择商品类型-")); } } else { ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('请登录在进行查询。');window.location.href='Login.aspx';</script>"); } } }
public string PhotoUrl; //图片路径(预览用) protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { spClientName.InnerHtml = "【" + Server.UrlDecode(getCookies["ClientName"].ToString()) + "】 Welcome To Food Order Manager"; string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; var hour = string.Empty; if (DateTime.Now.Hour > 12) { hour = "下午" + DateTime.Now.Hour + "\n时"; } else { hour = "上午" + DateTime.Now.Hour + "\n时"; } spNowTime.InnerText = DateTime.Now.ToString("yyyy年MM月dd日") + "\n" + Day[Convert.ToInt16(DateTime.Now.DayOfWeek)] + "\n" + hour;; using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { var getSoStatus = (from p in db.goodssort select new { p.sortId, p.sortName }).ToList(); drpGoodsSort.DataTextField = "sortName"; drpGoodsSort.DataValueField = "sortId"; drpGoodsSort.DataSource = getSoStatus; drpGoodsSort.DataBind(); drpGoodsSort.Items.Insert(0, new ListItem("-请选择商品类型-")); } if (!string.IsNullOrEmpty(Request["upid"])) { if (SearchDataClass.IsNumber(Request["upid"]) == true) { this.btnUpdateGroupBuy.Attributes["onclick"] = "return GroupBuyValidate()"; } this.btnReset.Attributes["onclick"] = "return ClearGroupBuy()"; this.BindShowUpInfo(Request["upid"]); this.btnAddGroupBuy.Visible = false; this.btnUpdateGroupBuy.Visible = true; } else { this.btnAddGroupBuy.Attributes["onclick"] = "return GroupBuyValidate()"; this.btnReset.Attributes["onclick"] = "return ClearGroupBuy()"; this.btnAddGroupBuy.Visible = true; this.btnUpdateGroupBuy.Visible = false; } } else { ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('请登录在进行查询。');window.location.href='Login.aspx';</script>"); } } }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { notices getNot = db.notices.Single(x => x.Id == int.Parse(strUpid)); txtTitle.Value = SearchDataClass.CheckStr(getNot.title);; txtFckContent.Value = getNot.content; //SearchDataClass.CheckStr(getNot.content); //drpValidate.SelectedValue = getNot.validate.ToString(); //drpSetIndex.SelectedValue = getNot.setindex.ToString(); this.drpNewsSort.SelectedValue = getNot.newssort.ToString(); this.hfDel.Value = getNot.img; this.HFurl.Value = getNot.img; if (!string.IsNullOrEmpty(getNot.img)) { this.iShowPhoto.Src = getNot.img; } else { this.iShowPhoto.Src = "assets/images/nophoto.gif"; } this.hfDel1.Value = getNot.img1; this.HFurl1.Value = getNot.img1; if (!string.IsNullOrEmpty(getNot.img1)) { this.iShowPhoto1.Src = getNot.img1; } else { this.iShowPhoto1.Src = "assets/images/nophoto.gif"; } this.hfDel2.Value = getNot.img2; this.HFurl2.Value = getNot.img2; if (!string.IsNullOrEmpty(getNot.img2)) { this.iShowPhoto2.Src = getNot.img2; } else { this.iShowPhoto2.Src = "assets/images/nophoto.gif"; } txtSource.Value = getNot.newssource; } } } }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodstuan getOrderBy = db.goodstuan.Single(x => x.Id == int.Parse(strUpid)); txtTitle.Value = getOrderBy.title; txtFckContent.Value = SearchDataClass.CheckStr(getOrderBy.content); txtTimeSelect.Value = Convert.ToDateTime(getOrderBy.starttime).ToString("yyyy/MM/dd") + "-" + Convert.ToDateTime(getOrderBy.endtime).ToString("yyyy/MM/dd"); drpValidate.SelectedValue = getOrderBy.validate.ToString(); drpSetIndex.SelectedValue = getOrderBy.setindex.ToString(); txtQuantily.Value = getOrderBy.quantity.ToString(); txtGoodsPrice.Value = Convert.ToString(getOrderBy.price); txtGoodsCost.Value = Convert.ToString(getOrderBy.costprice.ToString()); txtWeight.Value = getOrderBy.weight.ToString(); // drpCommunity.SelectedValue = getOrderBy.community.ToString(); //drpShop.SelectedValue = getOrderBy.shopid.ToString(); txtGroupNum.Value = getOrderBy.batch.ToString(); txtSummary.Value = getOrderBy.tuansummary; txtSummary1.Value = getOrderBy.tuansummary1; txtSummary2.Value = getOrderBy.tuansummary2; this.hfDel.Value = getOrderBy.img; this.HFurl.Value = getOrderBy.img; this.iShowPhoto.Src = getOrderBy.img == "" ? "assets/images/nophoto.gif" : getOrderBy.img;; this.hfDel1.Value = getOrderBy.imgtwo; this.HFurl1.Value = getOrderBy.imgtwo; this.iShowPhoto1.Src = getOrderBy.imgtwo == "" ? "assets/images/nophoto.gif" : getOrderBy.imgtwo; this.hfDel2.Value = getOrderBy.groupsortimg; this.HFurl2.Value = getOrderBy.groupsortimg; if (!string.IsNullOrEmpty(getOrderBy.groupsortimg)) { this.iShowPhoto2.Src = getOrderBy.groupsortimg; } else { this.iShowPhoto2.Src = "assets/images/nophoto.gif"; } drpGoodsSort.SelectedIndex = getOrderBy.groupsort; drpSaleGoodsSort.SelectedValue = getOrderBy.selectytsort.ToString(); txtGoodsCode.Value = getOrderBy.goodscode; txtGetGoodPoint.Value = getOrderBy.getgoodpoint.ToString(); db.SubmitChanges(); } } } }
protected void btnUpdateGoods_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["upid"])) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(Request["upid"]) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage upNot = db.goodspackage.Single(x => x.goodsId == int.Parse(Request["upid"])); upNot.goodstitle = txtTitle.Value.Trim(); upNot.goodscontent = SearchDataClass.CheckStr(txtFckContent.Value); upNot.goodsvalidate = Convert.ToChar(drpValidate.SelectedValue); upNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); upNot.goodscode = txtGoodsCode.Value; upNot.goodsprice = Convert.ToDecimal(txtGoodsPrice.Value); upNot.goodssort = int.Parse(drpGoodsSort.SelectedValue); if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.goodsimg = HFurl.Value.Trim(); } upNot.goodstock = int.Parse(txtStockNum.Value); upNot.goodsSales = Convert.ToChar(drpSales.SelectedValue); upNot.goodscost = Convert.ToDecimal(txtGoodsCost.Value); upNot.ifexchange = Convert.ToChar(drpExchangeGood.SelectedValue); if (!string.IsNullOrEmpty(txtExchangePoint.Value)) { upNot.exchangepoint = int.Parse(txtExchangePoint.Value); } if (!string.IsNullOrEmpty(txtGetGoodPoint.Value)) { upNot.getgoodpoint = int.Parse(txtGetGoodPoint.Value); } upNot.tichengpoint = ticheng.Value == "" ? "0/20/20/10" : ticheng.Value; //upNot.goodgoldprice = Convert.ToDecimal(txtGoldPrice.Value); //upNot.goodsilverprice = Convert.ToDecimal(txtSilverprice.Value); upNot.ifxiangou = Convert.ToChar(drpXianGou.SelectedValue); upNot.xiangounumber = txtXianGouNumber.Value == "" ? "0/0/0" : txtXianGouNumber.Value;; upNot.goodsspec = txtGoodsSpec.Value; upNot.goodscompany = txtGoodsCompany.Value; //upNot.iftuangou = Convert.ToChar(drpGroupBy.SelectedValue); // upNot.expiredate = Convert.ToDateTime(txtExpireDate.Value); // upNot.selectytsort = Convert.ToChar(drpSaleGoodsSort.SelectedValue); db.SubmitChanges(); } } Response.Redirect("GoodsPackageManager.aspx?mid=" + Request["mid"]); } }
/// <summary> /// 上传图片并显示出来/并保存到隐藏域路径.以待点击预览图片查看图片 protected void iUpLoad_Click(object sender, EventArgs e) { string test = Server.MapPath("UpLoadImg/GroupBuyImage"); //用来生成文件夹 if (!Directory.Exists(test)) { Directory.CreateDirectory(test); } int filesize = 4096; if (!string.IsNullOrEmpty(fUpLoad.PostedFile.FileName)) { if (fUpLoad.PostedFile.ContentLength / 4096 > filesize) { Page.RegisterStartupScript("Startup", "<script>alert('单张团购图片不能超过4096K(4M),请重新选择团购图片上传。');</script>"); } else { if (!string.IsNullOrEmpty(hfDel.Value)) //判断要修改图片路径是否为空,来进行添加还是删除文件夹的图片然后在上传图片 { SearchDataClass.DeleteDir(Server.MapPath(hfDel.Value)); string imgname = fUpLoad.PostedFile.FileName; string imgType = imgname.Substring(imgname.LastIndexOf(".") + 1); string quanname = Guid.NewGuid() + "." + imgType; string imgurl = "UpLoadImg/GroupBuyImage/" + quanname; this.iShowPhoto.Src = imgurl; fUpLoad.PostedFile.SaveAs(Server.MapPath(imgurl)); this.HFurl.Value = imgurl; Page.RegisterStartupScript("starup", "<script>alert('团购图片修改成功。点击预览查看团购图片。');</script>"); } else { string imgname = fUpLoad.PostedFile.FileName; string imgType = imgname.Substring(imgname.LastIndexOf(".") + 1); string quanname = Guid.NewGuid() + "." + imgType; string imgurl = "UpLoadImg/GroupBuyImage/" + quanname; this.iShowPhoto.Src = imgurl; fUpLoad.PostedFile.SaveAs(Server.MapPath(imgurl)); this.HFurl.Value = imgurl; Page.RegisterStartupScript("starup", "<script>alert('团购图片上传成功。点击预览查看团购图片。');</script>"); } } } else { Page.RegisterStartupScript("starup", "<script>alert('请选择团购商品图片上传');</script>"); } }
protected void btnAddPlantDoctor_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { plantdoctor addNot = new plantdoctor(); addNot.title = txtTitle.Value.Trim(); addNot.content = SearchDataClass.CheckStr(txtFckContent.Value); addNot.validate = Convert.ToChar(drpValidate.SelectedValue); addNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); addNot.plantdoctorsort = int.Parse(drpPlantDoctorSort.SelectedValue); addNot.img = HFurl.Value.Trim(); addNot.addtime = DateTime.Now; db.plantdoctor.InsertOnSubmit(addNot); db.SubmitChanges(); } Response.Redirect("PlantDoctorManager.aspx"); }
protected void btnExportExcel_ServerClick(object sender, EventArgs e) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { DateTime dt = DateTime.Now; DateTime dtBegin = new DateTime(); DateTime dtEnd = new DateTime(); if (string.IsNullOrEmpty(txtTimeSelect.Value.Trim())) { DateTime startMonth = dt.AddDays(1 - dt.Day); //本月月初 DateTime endMonth = startMonth.AddMonths(1).AddDays(-1); //本月月末 dtBegin = startMonth; dtEnd = endMonth; } else { string[] strDate = txtTimeSelect.Value.Trim().Split('-'); dtBegin = Convert.ToDateTime(strDate[0]); dtEnd = Convert.ToDateTime(strDate[1]); } var getFinanceMonthData = SearchDataClass.ExportFinanceMonthInfoListData(dtBegin, dtEnd); //创建一个workbookdesigner对象 WorkbookDesigner designer = new WorkbookDesigner(); //制定报表模板 designer.Open(Server.MapPath(@"model\FinanceMonthList.xls")); //设置实体类对象 designer.SetDataSource("Export", getFinanceMonthData); //根据数据源处理生成报表内容 designer.Process(); //客户端保存的文件名 string fileName = HttpUtility.UrlEncode("月销售金额报表统计导出") + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; designer.Save(fileName, SaveType.OpenInExcel, FileFormatType.Excel2003, Response); Response.Flush(); Response.Close(); designer = null; Response.End(); } }
protected void btnUpdateNotices_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["upid"])) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(Request["upid"]) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { notices upNot = db.notices.Single(x => x.Id == int.Parse(Request["upid"])); upNot.title = SearchDataClass.CheckStr(txtTitle.Value.Trim());; upNot.content = txtFckContent.Value; //SearchDataClass.CheckStr(txtFckContent.Value); //upNot.validate = Convert.ToChar(drpValidate.SelectedValue); //upNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); upNot.newssort = int.Parse(drpNewsSort.SelectedValue); if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.img = HFurl.Value.Trim(); } if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.img1 = HFurl1.Value.Trim(); } if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.img2 = HFurl2.Value.Trim(); } upNot.newssource = txtSource.Value.Trim(); upNot.addtime = DateTime.Now; db.SubmitChanges(); } } Response.Redirect("NewsNoticesManager.aspx?mid=" + Request["mid"]); } }
protected void btnAddGoods_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage addNot = new goodspackage(); addNot.goodstitle = txtTitle.Value.Trim(); addNot.goodscontent = SearchDataClass.CheckStr(txtFckContent.Value); addNot.goodsvalidate = Convert.ToChar(drpValidate.SelectedValue); addNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); addNot.goodscode = txtGoodsCode.Value; addNot.goodsprice = Convert.ToDecimal(txtGoodsPrice.Value); addNot.goodssort = int.Parse(drpGoodsSort.SelectedValue); addNot.goodsimg = HFurl.Value.Trim(); addNot.addtime = DateTime.Now; addNot.goodstock = int.Parse(txtStockNum.Value); addNot.goodsSales = Convert.ToChar(drpSales.SelectedValue); addNot.getgoodpoint = txtGetGoodPoint.Value == "" ? 0 : int.Parse(txtGetGoodPoint.Value); addNot.goodscost = txtGoodsCost.Value == "" ? 0.00m : Convert.ToDecimal(txtGoodsCost.Value); addNot.ifexchange = Convert.ToChar(drpExchangeGood.SelectedValue); addNot.exchangepoint = txtExchangePoint.Value == "" ? 0 : int.Parse(txtExchangePoint.Value); addNot.tichengpoint = ticheng.Value == "" ? "0/20/20/10" : ticheng.Value; //addNot.goodgoldprice = txtGoldPrice.Value == "" ? 0.00m : Convert.ToDecimal(txtGoldPrice.Value); //addNot.goodsilverprice = txtSilverprice.Value == "" ? 0.00m : Convert.ToDecimal(txtSilverprice.Value); addNot.ifxiangou = Convert.ToChar(drpXianGou.SelectedValue); addNot.xiangounumber = txtXianGouNumber.Value == "" ? "0/0/0" : txtXianGouNumber.Value; addNot.goodsspec = txtGoodsSpec.Value; addNot.goodscompany = txtGoodsCompany.Value; //addNot.iftuangou = Convert.ToChar(drpGroupBy.SelectedValue); //addNot.expiredate = Convert.ToDateTime(txtExpireDate.Value); //addNot.selectytsort = Convert.ToChar(drpSaleGoodsSort.SelectedValue); db.goodspackage.InsertOnSubmit(addNot); db.SubmitChanges(); } Response.Redirect("GoodsPackageManager.aspx?mid=" + Request["mid"]); }
protected void btnExportExcel_ServerClick(object sender, EventArgs e) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { //var timeSearch = string.Empty; //if (string.IsNullOrEmpty(txtTimeSelect.Value.Trim())) //{ // timeSearch = "NowMonth"; //} //else //{ // timeSearch = txtTimeSelect.Value.Trim(); //} var getGoodsShipData = SearchDataClass.GetSearchGoodsShipData(txtOrderNo.Value, txtGoodsName.Value, txtBuyName.Value, txtCompany.Value, txtGuDong.Value, txtZhanZhang.Value, txtTimeSelect.Value.Trim(), drpShopSet.SelectedValue, drpGoodShipStatus.SelectedValue); //创建一个workbookdesigner对象 WorkbookDesigner designer = new WorkbookDesigner(); //制定报表模板 designer.Open(Server.MapPath(@"model\goodshipreport.xls")); List <SearchGoodsShipData> newGoodShip = new List <SearchGoodsShipData>(); if (getGoodsShipData.Count > 0) { foreach (var item in getGoodsShipData) { SearchGoodsShipData info = new SearchGoodsShipData(); info.ShipStatus = item.GoodShipStatus == '0' ? "未发货" : "已发货"; info.GoodShipNo = item.GoodShipNo; info.SjGuDongInfo = item.SjGuDongInfo == null ? "无上级股东信息" : item.SjGuDongInfo; info.SjZhanZhangInfo = item.SjZhanZhangInfo == null ? "无上级站长信息" : item.SjZhanZhangInfo; info.OrderNo = item.OrderNo; info.OrderPrice = item.OrderPrice; info.name = item.name; info.tel = item.tel; info.GoodsTitle = item.GoodsTitle; info.GoodsCode = item.GoodsCode; info.BuySumQty = item.BuySumQty; info.housemoney = item.housemoney; info.areacity = item.areacity; info.address = item.address; info.GoodsCompany = item.GoodsCompany; info.GoodsPrice = item.GoodsPrice; info.GoodsCost = item.GoodsCost; info.GoodsSpec = item.GoodsSpec; info.PaymentTime = item.PaymentTime; info.juese = item.juese; newGoodShip.Add(info); } } //设置实体类对象 designer.SetDataSource("Export", newGoodShip); //根据数据源处理生成报表内容 designer.Process(); //客户端保存的文件名 string fileName = HttpUtility.UrlEncode("商品发货表导出") + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; designer.Save(fileName, SaveType.OpenInExcel, FileFormatType.Excel2003, Response); Response.Flush(); Response.Close(); designer = null; Response.End(); } }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage getNot = db.goodspackage.Single(x => x.goodsId == int.Parse(strUpid)); txtTitle.Value = getNot.goodstitle; txtFckContent.Value = SearchDataClass.CheckStr(getNot.goodscontent); drpValidate.SelectedValue = getNot.goodsvalidate.ToString(); drpSetIndex.SelectedValue = getNot.setindex.ToString(); this.drpGoodsSort.SelectedValue = getNot.goodssort.ToString(); txtGoodsCode.Value = getNot.goodscode; txtGoodsPrice.Value = getNot.goodsprice.ToString();; this.hfDel.Value = getNot.goodsimg; this.HFurl.Value = getNot.goodsimg; if (!string.IsNullOrEmpty(getNot.goodsimg)) { this.iShowPhoto.Src = getNot.goodsimg; } else { this.iShowPhoto.Src = "assets/images/nophoto.gif"; } txtStockNum.Value = getNot.goodstock.ToString(); drpSales.SelectedValue = getNot.goodsSales.ToString(); txtGoodsCost.Value = getNot.goodscost.ToString();; txtExchangePoint.Value = getNot.exchangepoint.ToString();; drpExchangeGood.SelectedValue = getNot.ifexchange.ToString(); txtGetGoodPoint.Value = getNot.getgoodpoint.ToString(); //txtGoldPrice.Value = getNot.goodgoldprice.ToString(); //txtSilverprice.Value = getNot.goodsilverprice.ToString(); //判断分成比例 0/20/20/10 var tichengsplit = getNot.tichengpoint.Split('/'); decimal fencheng1 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[1]) / Convert.ToDecimal(100); decimal fencheng2 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[2]) / Convert.ToDecimal(100); decimal fencheng3 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[3]) / Convert.ToDecimal(100); if (tichengsplit.Length > 0) { if (int.Parse(tichengsplit[0]) == 0) { //sp1.InnerText = "分成比例20%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[1]) / 100))).ToString("N2") + "元"; //sp2.InnerText = "分成比例20%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[2]) / 100))).ToString("N2") + "元"; //sp3.InnerText = "分成比例10%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[3]) / 100))).ToString("N2") + "元"; sp1.InnerText = "分成比例20%=" + Convert.ToDecimal(fencheng1).ToString("N2") + "元"; sp2.InnerText = "分成比例20%=" + Convert.ToDecimal(fencheng2).ToString("N2") + "元"; sp3.InnerText = "分成比例10%=" + Convert.ToDecimal(fencheng3).ToString("N2") + "元"; } else { Text1.Value = tichengsplit[1]; Text2.Value = tichengsplit[2]; Text3.Value = tichengsplit[3]; //spz1.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[1]) / 100))).ToString("N2") + "元"; //spz2.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[2]) / 100))).ToString("N2") + "元"; //spz3.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[3]) / 100))).ToString("N2") + "元"; spz1.InnerText = "%=" + Convert.ToDecimal(fencheng1).ToString("N2") + "元"; spz2.InnerText = "%=" + Convert.ToDecimal(fencheng2).ToString("N2") + "元"; spz3.InnerText = "%=" + Convert.ToDecimal(fencheng3).ToString("N2") + "元"; } } drpXianGou.SelectedValue = getNot.ifxiangou.ToString(); txtXianGouNumber.Value = getNot.xiangounumber.ToString(); txtGoodsSpec.Value = getNot.goodsspec; txtGoodsCompany.Value = getNot.goodscompany; //drpGroupBy.SelectedValue = getNot.iftuangou.ToString(); //txtExpireDate.Value = Convert.ToDateTime(getNot.expiredate).ToString("yyyy/MM/dd"); //drpSaleGoodsSort.SelectedValue = getNot.selectytsort.ToString(); } } } }
protected void btnExportExcel_ServerClick(object sender, EventArgs e) { HttpCookie getCookies = Request.Cookies["UserLogin"]; if (getCookies != null) { var timeSearch = string.Empty; if (string.IsNullOrEmpty(txtTimeSelect.Value.Trim())) { var dtBegin = DateTime.Now.ToString("yyyy/MM/dd"); var dtEnd = DateTime.Now.ToString("yyyy/MM/dd"); timeSearch = dtBegin + " - " + dtEnd; } else { timeSearch = txtTimeSelect.Value.Trim(); } var getBadProData = SearchDataClass.GetSearchUserRechargeInfoData(txtRechargeTel.Value.Trim(), drpRechargeStatus.SelectedValue, timeSearch); ArrayList ColTitle = new ArrayList() { "充值流水号", "充值日期", "充值手机", "充值人", "充值金额", "充值名称", "充值状态" }; //string[] strTitle = new string[] { "ASNNo", "SKU", "SKUDescrC", "ExpectedQty", "ReceivedQty", "UOM", "ReceivingLocation", "ReceivedTime", "CustomerID", "CodeName_C" }; if (getBadProData.ToList().Count > 0) { Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(); //创建一个sheet Aspose.Cells.Worksheet sheet = workbook.Worksheets[0]; //为单元格添加样式 Aspose.Cells.Style style = workbook.Styles[workbook.Styles.Add()]; style.HorizontalAlignment = Aspose.Cells.TextAlignmentType.Center; style.Borders[Aspose.Cells.BorderType.LeftBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; //应用边界线 左边界线 style.Borders[Aspose.Cells.BorderType.RightBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; //应用边界线 右边界线 style.Borders[Aspose.Cells.BorderType.TopBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; //应用边界线 上边界线 style.Borders[Aspose.Cells.BorderType.BottomBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; //应用边界线 下边界线 //给各列的标题行PutValue赋值 int currow = 0; byte curcol = 0; sheet.Cells.ImportCustomObjects((System.Collections.ICollection)getBadProData, null, true, 0, 0, getBadProData.Count, true, "yyyy/MM/dd HH:mm:ss", false); // 设置内容样式 for (int i = 0; i < getBadProData.ToList().Count; i++) { sheet.Cells[i + 1, 0].PutValue(getBadProData[i].RecNo); sheet.Cells[i + 1, 1].PutValue(getBadProData[i].RecTime); sheet.Cells[i + 1, 2].PutValue(getBadProData[i].Tel); sheet.Cells[i + 1, 3].PutValue(getBadProData[i].UserName); sheet.Cells[i + 1, 4].PutValue(getBadProData[i].RecMoeny); var recstatus = string.Empty; var successinfo = string.Empty; switch (getBadProData[i].RecStatus) { case 'N': recstatus = "交易失败"; successinfo = "充值失败"; break; case 'Y': recstatus = "交易成功"; successinfo = "充值成功"; break; //case 'S': // recstatus = "分红成功"; // successinfo = "充值成功"; // break; case 'C': recstatus = "撤销充值"; successinfo = "撤销充值成功"; break; } //if (getBadProData[i].RecStatus == 'N') //{ // recstatus = "交易失败"; // successinfo = "充值失败"; //} //else //{ // recstatus = "交易成功"; // successinfo = "充值成功"; //} sheet.Cells[i + 1, 5].PutValue(getBadProData[i].RecContent == "" ? "东方柏农-" + getBadProData[i].RecTime.ToString("yyyy.MM.dd") + "-" + successinfo : getBadProData[i].RecContent); sheet.Cells[i + 1, 6].PutValue(recstatus); for (int j = 0; j < 7; j++) { sheet.Cells[i + 1, j].Style = style; sheet.Cells[i + 1, 1].Style.Custom = "yyyy/MM/dd HH:mm:ss"; //sheet.Cells[i + 1, 5].Style.Custom = "yyyy/MM/dd HH:mm:ss"; } } // 设置标题样式及背景色 foreach (string s in ColTitle) { sheet.Cells[currow, curcol].PutValue(s); style.ForegroundColor = System.Drawing.Color.FromArgb(153, 204, 0); style.Pattern = Aspose.Cells.BackgroundType.Solid; style.Font.IsBold = true; sheet.Cells[currow, curcol].Style = style; curcol++; } Aspose.Cells.Cells cells = sheet.Cells; //设置标题行高 cells.SetRowHeight(0, 30); //让各列自适应宽度 sheet.AutoFitColumns(); //生成数据流 System.IO.MemoryStream ms = workbook.SaveToStream(); byte[] bt = ms.ToArray(); //客户端保存的文件名 string fileName = "用户充值列表导出_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; //以字符流的形式下载文件 // Response.ContentType = "application/vnd.ms-excel"; //通知浏览器下载文件而不是打开 Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); Response.BinaryWrite(bt); Response.Flush(); Response.End(); } } }