/// <summary> /// 根据起始和结束时间,自动计算出难度系数 /// 1,忽略教师未批阅的 /// 2,如果本周未有学生考试则不更新 /// 3,(计算公式是否应该改为难度偏移计算,以更准确) /// </summary> public void CountDiffcult(string stime, string etime) { string where = "WHERE IsRight>0 AND QID>0 "; if (!string.IsNullOrEmpty(stime)) { where += " AND CDate>=@stime"; } if (!string.IsNullOrEmpty(etime)) { where += " AND CDate<=@etime"; } SqlParameter[] sp = new SqlParameter[] { new SqlParameter("stime", DataConvert.CDate(stime)), new SqlParameter("etime", DataConvert.CDate(etime)) }; string sql = "SELECT Qid," + "(SELECT COUNT(*)AS Num FROM ZL_Exam_Answer WHERE QID=A.Qid AND IsRight=1)as rightNum," + "(SELECT COUNT(*)AS Num FROM ZL_Exam_Answer WHERE QID=A.Qid AND IsRight=2)as wrongNum " + "FROM ZL_Exam_Answer A " + where + " GROUP BY QID"; DataTable dt = SqlHelper.ExecuteTable(sql, sp); foreach (DataRow dr in dt.Rows) { double diff = DataConvert.CDouble(dr["rightNum"]) / (DataConvert.CDouble(dr["wrongNum"]) + DataConvert.CDouble(dr["rightNum"])); string upsql = "UPDATE " + strTableName + " SET p_Difficulty=" + diff + " WHERE p_id=" + dr["QID"]; SqlHelper.ExecuteSql(upsql); } }
protected void Submit_B_Click(object sender, EventArgs e) { M_Design_Page pageMod = scenceBll.SelReturnModel(Mid); pageMod.Title = Title_T.Text; pageMod.Score = DataConvert.CDouble(Request.Form["score_num"]); pageMod.Status = DataConvert.CLng(Status_Rad.SelectedValue); if (ThumbImg_UP.HasFile) { ThumbImg_UP.SaveFile(); pageMod.ThumbImg = ThumbImg_UP.FileUrl; } else //未指定文件,则以文本框中的为准 { pageMod.ThumbImg = ThumbImg_UP.FVPath; } if (PreviewImg_UP.HasFile) { HttpPostedFile file = PreviewImg_UP.Request.Files[0]; var image = System.Drawing.Image.FromStream(file.InputStream); PreviewImg_UP.SaveFile(); pageMod.PreviewImg = PreviewImg_UP.FileUrl; } else { pageMod.PreviewImg = PreviewImg_UP.FVPath; } pageMod.UserID = DataConvert.CLng(UserID_Hid.Value.Trim(' ')); pageMod.UserName = buser.SelReturnModel(pageMod.UserID).UserName; pageMod.Seflag = Request.Form["seflag_chk"]; pageMod.Meta = Meta_T.Text; pageMod.Remind = Remind_T.Text; scenceBll.UpdateByID(pageMod); function.WriteSuccessMsg("操作成功!", "SceneList.aspx"); }
/// <summary> /// 返回店铺销售汇总 /// </summary> /// <param name="sid"></param> /// <returns></returns> public DataRow GetSummary(F_Shop_SaleReport filter) { string fields = "Count(ID) OrderNum,SUM(Receivablesamount) OrderTotal"; string where = "1=1 "; if (filter.StoreID != -100) { where += " AND StoreID=" + filter.StoreID; } List <SqlParameter> sp = new List <SqlParameter>(); if (!string.IsNullOrEmpty(filter.SDate)) { where += " AND PayTime>=@stime"; sp.Add(new SqlParameter("stime", Convert.ToDateTime(filter.SDate).ToString("yyyy/MM/dd 00:00:00"))); } if (!string.IsNullOrEmpty(filter.EDate)) { where += " AND PayTime<=@etime"; sp.Add(new SqlParameter("etime", Convert.ToDateTime(filter.EDate).ToString("yyyy/MM/dd 23:59:59"))); } DataTable dt = DBCenter.SelWithField("ZL_Order_PayedView", fields, where, "", sp); dt.Columns.Add("KDJ", typeof(string)); DataRow dr = dt.Rows[0]; dr["OrderTotal"] = DataConvert.CDouble(dr["OrderTotal"]).ToString("F2"); dr["KDJ"] = (DataConvert.CDouble(dr["OrderTotal"]) / DataConvert.CLng(dr["OrderNum"])).ToString("F2"); return(dr); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_Design_Tlp tlpMod = new M_Design_Tlp(); if (Mid > 0) { tlpMod = tlpBll.SelReturnModel(Mid); } tlpMod.TlpName = TlpName_T.Text; tlpMod.Price = DataConvert.CDouble(Price_T.Text); tlpMod.Remind = Remind_T.Text; tlpMod.ClassID = DataConvert.CLng(Node_Hid.Value); tlpMod.ZStatus = DataConvert.CLng(Request.Form["zstatus_rad"]); tlpMod.Score = DataConvert.CDouble(Request.Form["score_num"]); if (!PreView_UP.FVPath.Equals(tlpMod.PreviewImg, StringComparison.CurrentCultureIgnoreCase)) { if (PreView_UP.HasFile) { tlpMod.PreviewImg = PreView_UP.SaveFile(); } else { tlpMod.PreviewImg = PreView_UP.FVPath; } } if (Mid > 0) { tlpBll.UpdateByID(tlpMod); } else { tlpBll.AddNewTlp(tlpMod); } function.WriteSuccessMsg("操作成功", "TlpList.aspx?type=" + ZType); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = buser.GetLogin(); if (Mid > 0) { regularMod = regularBll.SelReturnModel(Mid); } regularMod.Alias = Alias_T.Text.Trim(); regularMod.Min = DataConvert.CDouble(Min_T.Text); if (regularMod.Min <= 0) { function.WriteErrMsg("充值金额不能为0"); } regularMod.Purse = DataConvert.CDouble(Purse_T.Text); regularMod.Point = DataConvert.CDouble(Point_T.Text); regularMod.AdminRemind = AdminRemind_T.Text.Trim(); regularMod.AdminID = regularMod.AdminID; if (Mid > 0) { regularMod.EditDate = DateTime.Now; regularBll.UpdateByID(regularMod); } else { regularMod.StoreID = mu.SiteID; //if (regularBll.IsExist(regularMod.Min)) { function.WriteErrMsg("充值金额[" + regularMod.Min.ToString("f2") + "]的规则已存在,不可重复添加"); } regularBll.Insert(regularMod); } function.WriteSuccessMsg("保存成功", "MoneyRegular.aspx"); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_Design_SiteInfo sfMod = sfBll.SelReturnModel(Mid); sfMod.SiteName = SiteName_T.Text; Logo_UP.SaveUrl = sfMod.SiteDir + "/UploadFiles/"; if (!Logo_UP.FVPath.Equals(sfMod.Logo, StringComparison.CurrentCultureIgnoreCase)) { if (Logo_UP.HasFile) { sfMod.Logo = Logo_UP.SaveFile(); } else { sfMod.Logo = Logo_UP.FVPath; } } sfMod.Score = DataConvert.CDouble(Request.Form["score_num"]); //if (Logo_UP.FileContent.Length > 100 && SafeSC.IsImage(Logo_UP.FileName)) //{ // sfMod.Logo = SafeSC.SaveFile(sfMod.SiteDir + "/UploadFiles/", Logo_UP); //} sfBll.UpdateByID(sfMod); function.WriteSuccessMsg("修改成功", "SiteList.aspx"); }
protected void MyBind() { int quick = Convert.ToInt32(QuickSearch_DP.SelectedValue); int skeyType = Convert.ToInt32(SkeyType_DP.SelectedValue); string uids = ""; if (PUid > 0) { Call.HideBread(Master); DataTable udt = buser.SelPromoUser(PUid); foreach (DataRow dr in udt.Rows) { uids += dr["UserID"] + ","; } uids = uids.Trim(','); } DataTable dt = orderBll.SearchByQuickAndSkey(OrderType, OrderStatus, PayStatus, quick, skeyType, Skey_T.Text, StoreID, uids); TotalSum_Hid.Value = DataConvert.CDouble(dt.Compute("SUM(ordersamount)", "")).ToString("f2"); switch (OrderType) { case "1": //酒店 case "3": //旅游 function.Script(this, "ShowElement('hotel_tb');"); Hotel_RPT.DataSource = dt; Hotel_RPT.DataBind(); break; default: function.Script(this, "ShowElement('store_tb');"); Store_RPT.DataSource = dt; Store_RPT.DataBind(); break; } }
/// <summary> /// 数据表转换为Excel,页面根据需要存储或返回 /// </summary> public static MemoryStream Excel_OutByDT(DataTable dt) { MemoryStream ms = new MemoryStream(); IWorkbook workbook = new XSSFWorkbook(); ISheet sheet1 = workbook.CreateSheet("Sheet1"); IRow headRow = sheet1.CreateRow(0); ICellStyle headStyle = workbook.CreateCellStyle(); headStyle.FillPattern = FillPattern.SolidForeground; for (int i = 0; i < dt.Columns.Count; i++) { DataColumn dc = dt.Columns[i]; headRow.CreateCell(i).SetCellValue(dc.ColumnName); } //----------------- for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet1.CreateRow(i + 1); int index = 0; foreach (DataColumn dc in dt.Columns) { string value = DataConverter.CStr(dt.Rows[i][dc.ColumnName]); if (dc.DataType.Equals("System.Decimal")) { value = DataConvert.CDouble(value).ToString("F2"); } row.CreateCell(index).SetCellValue(value); index++; } } sheet1.AutoSizeColumn(1); workbook.Write(ms); return(ms); }
private DataTable SelPage(int pageSize, int pageIndex) { M_UserInfo mu = buser.GetLogin(); Filter_Order filter = new Filter_Order(); filter.cpage = pageIndex; filter.psize = pageSize; filter.orderType = OrderType; //filter.uids = ClientUid.ToString(); filter.storeType = mu.SiteID.ToString(); PageSetting setting = ExOrder.Order_Sel(filter); OrderDT = setting.dt; StoreDT = orderCom.SelStoreDT(OrderDT); //Skey_T.Text = Skey; DataTable dt = new DataTableHelper().DistinctByField(OrderDT, "ID"); if (dt != null && dt.Rows.Count > 0) { TotalSum_Hid.Value = DataConvert.CDouble(OrderDT.Compute("SUM(ordersamount)", "")).ToString("f2"); //function.Script(this, "CheckOrderType('" + Filter + "')"); Order_RPT.ItemCount = setting.itemCount; empty_div.Visible = false; } else { empty_div.Visible = true; TotalSum_Hid.Value = "0"; } return(dt); }
/// <summary> /// 用于前后台|店铺筛选订单(支持快速搜索) /// </summary> public PageSetting SelPage(int cpage, int psize, out double total, int storeid, string orderType, string orderStatus, string payStatus) { string where = "1=1 "; if (storeid != -100) { where += " AND StoreID=" + storeid; } if (!string.IsNullOrEmpty(orderType)) { SafeSC.CheckIDSEx(orderType); where += " AND OrderType IN (" + orderType + ")"; } if (!string.IsNullOrEmpty(orderStatus)) { where += " AND OrderStatus=" + DataConvert.CLng(orderStatus); } if (!string.IsNullOrEmpty(payStatus)) { where += " AND Paymentstatus=" + DataConvert.CLng(payStatus); } PageSetting setting = PageSetting.Single(cpage, psize, TbName, PK, where, "", null); DBCenter.SelPage(setting); total = DataConvert.CDouble(DBCenter.ExecuteScala(TbName, "SUM(ordersamount)", where)); return(setting); }
protected void Save_Click(object sender, EventArgs e) { M_Ex_Coupon model = new M_Ex_Coupon(); if (Mid > 0) { model = cupBll.SelReturnModel(Mid); } model.Code = Code_T.Text.Trim(); model.AMount = DataConvert.CDouble(Amount_T.Text); model.ZStatus = status_chk.Checked ? 1 : 0; model.ZType = Request.Form["ztype"]; if (string.IsNullOrEmpty(model.Code)) { function.WriteErrMsg("用户券编号不能为空"); } if (model.AMount <= 0) { function.WriteErrMsg("优惠额度不能<=0"); } if (model.ZType == "比率" && model.AMount > 0.99) { function.WriteErrMsg("优惠额度错误,必须在0.01-0.99之间"); } if (model.ID > 0) { cupBll.UpdateByID(model); } else { cupBll.Insert(model); } function.Script(this, "alert('操作成功');parent.mybind();"); }
private DataTable SelPage(int pageSize, int pageIndex) { ZoomLa.BLL.B_CartPro.Filter_Order filter = new ZoomLa.BLL.B_CartPro.Filter_Order(); filter.cpage = pageIndex; filter.psize = pageSize; filter.storeType = StoreType_DP.SelectedValue; filter.orderType = OrderType; filter.addon = Filter; filter.proname = ProName_T.Text; filter.orderno = OrderNo_T.Text; filter.reuser = ReUser_T.Text; filter.mobile = Mobile_T.Text; filter.uids = UserID_T.Text; filter.stype = SkeyType_DP.SelectedValue; filter.skey = Skey_T.Text; filter.stime = STime_T.Text; filter.etime = ETime_T.Text; filter.expstime = ExpSTime_T.Text; filter.expetime = ExpETime_T.Text; //StoreType_DP.SelectedValue, OrderType, Filter, ProName_T.Text, OrderNo_T.Text, ReUser_T.Text, Mobile_T.Text, UserID_T.Text, SkeyType_DP.SelectedValue, Skey_T.Text, STime_T.Text, ETime_T.Text, ExpSTime_T.Text, ExpETime_T.Text PageSetting setting = cpBll.SelForOrderList(filter); OrderDT = setting.dt; StoreDT = orderCom.SelStoreDT(OrderDT); DataTable dt = new DataTableHelper().DistinctByField(OrderDT, "ID"); Skey_T.Text = Skey; empty_div.Visible = dt.Rows.Count < 1; TotalSum_Hid.Value = DataConvert.CDouble(OrderDT.Compute("SUM(ordersamount)", "")).ToString("f2"); //function.Script(this, "CheckOrderType('" + Filter + "')"); Order_RPT.ItemCount = setting.itemCount; return(dt); }
public static DataTable Report_SelByDay(Sale_Filter filter) { DateTime STime = Convert.ToDateTime(filter.stime); DateTime ETime = Convert.ToDateTime(filter.etime); B_OrderList orderBll = new B_OrderList(); DataTable saleDT = orderBll.Report_SelByDate(STime, ETime); DataTable dayDT = new DataTable(); dayDT.Columns.Add("date", typeof(string)); dayDT.Columns.Add("total", typeof(double)); for (DateTime s = STime; s <= ETime; s = s.AddDays(1)) { DataRow day = dayDT.NewRow(); //DateTime sdate = Convert.ToDateTime("{0}/{1}/{2} 00:00:00"); string sdate = s.ToString("#yyyy/MM/dd 00:00:00#"), edate = s.ToString("#yyyy/MM/dd 23:59:59#"); saleDT.DefaultView.RowFilter = "PayTime>= " + sdate + " AND PayTime<= " + edate; day["date"] = s.ToString("yyyy-MM-dd"); day["total"] = 0; foreach (DataRow dr in saleDT.DefaultView.ToTable().Rows) { day["Total"] = DataConvert.CDouble(day["Total"]) + DataConvert.CDouble(dr["OrdersAmount"]); } dayDT.Rows.Add(day); } return(dayDT); }
public void CopyToCartPro(M_OrderList Odata) { DataTable proDt = JsonConvert.DeserializeObject <DataTable>(Pro_Hid.Value); if (proDt == null) { return; } foreach (DataRow row in proDt.Rows) { M_CartPro cartMod = new M_CartPro(); M_Product proMod = proBll.GetproductByid(DataConvert.CLng(row["id"])); int num = DataConvert.CLng(row["pronum"]); cartMod.Orderlistid = Odata.id; cartMod.ProID = proMod.ID; cartMod.Pronum = num; cartMod.Proname = proMod.Proname; cartMod.Username = Odata.Reuser; cartMod.Shijia = proMod.LinPrice; cartMod.AllMoney = DataConvert.CDouble(Odata.Balance_price); cartMod.Danwei = proMod.ProUnit; cartMod.Addtime = DateTime.Now; cartMod.StoreID = DataConvert.CLng(Odata.StoreID); cartProBll.GetInsert(cartMod); } }
protected void Save_Btn_Click(object sender, EventArgs e) { M_UserInfo loginUser = buser.GetLogin(); M_Store_Info storeMod = storeBll.SelModelByUser(loginUser.UserID); M_UserInfo mu = null; string uname = UserName_T.Text.Trim(); string upwd = UserPwd_T.Text.Trim(); string upwd2 = UserPwd2_T.Text.Trim(); if (Mid > 0) { mu = buser.SelReturnModel(Mid); //修改密码 if (!string.IsNullOrEmpty(upwd)) { if (!upwd.Equals(upwd2)) { function.WriteErrMsg("密码与确认密码不匹配"); } mu.UserPwd = StringHelper.MD5(upwd); } } else { if (StrHelper.StrNullCheck(uname, upwd, upwd2)) { function.WriteErrMsg("用户名或密码不能为空"); } if (!upwd.Equals(upwd2)) { function.WriteErrMsg("密码与确认密码不匹配"); } if (buser.IsExistUName(uname)) { function.WriteErrMsg("用户名[" + uname + "]已存在"); } mu = buser.NewUser(uname, upwd); mu.SiteID = storeMod.ID; mu.GroupID = ExConast.EmployGroup; } mu.SiteRebateBalance = DataConvert.CDouble(SiteRebateBalance_T.Text); mu.ZnPassword = Mobile_T.Text; mu.VIP = DataConvert.CLng(Request.Form["bonus_rad"]); mu.PageID = DataConvert.CLng(Request.Form["role_rad"]); if (SFileUp.HasFile) { SFileUp.SaveUrl = ZLHelper.GetUploadDir_System("shop", "user"); mu.UserFace = SFileUp.SaveFile(); } if (mu.UserID > 0) { buser.UpdateByID(mu); } else { buser.AddModel(mu); } function.WriteSuccessMsg("操作成功", "Employee.aspx"); }
public static string TlpDeal(string tlp, DataRow dr) { B_CartPro cartProBll = new B_CartPro(); string result = tlp; if (dr != null) { #region dt中字段替换 DataTable dt = dr.Table; //遍历表格字段并替换 for (int i = 0; i < dt.Columns.Count; i++) { string colname = dt.Columns[i].ColumnName; string value = dr[colname].ToString(); if (dt.Columns[i].DataType.ToString().Equals("System.Decimal")) { value = DataConvert.CDouble(dr[colname]).ToString("f2"); } result = result.Replace("{" + colname + "}", value); } #endregion #region CartPro扩展字段 //CartPro字段,只取第一条信息循环输出 if (tlp.Contains("{CartPro.")) { DataTable cartDT = new DataTable(); cartDT = cartProBll.SelByOrderID(Convert.ToInt32(dt.Rows[0]["ID"])); if (cartDT.Rows.Count > 0) { dr = cartDT.Rows[0]; for (int i = 0; i < cartDT.Columns.Count; i++) { string colname = cartDT.Columns[i].ColumnName; string value = dr[colname].ToString(); if (cartDT.Columns[i].DataType.ToString().Equals("System.Decimal")) { value = Convert.ToDouble(dr[colname]).ToString("f2"); } result = result.Replace("{CartPro." + colname + "}", value); } } } #endregion // #region Extend扩展字段 // if (dt.Columns.Contains("Extend") && (!string.IsNullOrEmpty(dr["Extend"].ToString())))//扩展字段,可自由定义 // { // JObject model = (JObject)JsonConvert.DeserializeObject(dr["Extend"].ToString()); // foreach (var item in model) // { // result = result.Replace("{Extend."+item.Key+"}",item.Value.ToString()); // } // } //#endregion } //标签解析 //B_CreateHtml createBll = new B_CreateHtml(HttpContext.Current.Request); //result = createBll.CreateHtml(result); return(result); }
public string GetIcon() { double price = DataConvert.CDouble(Eval("Min").ToString()); int num = DataConvert.CLng(price / 100); num = num <= 0 ? 1 : num; return(num.ToString()); }
//店铺销售汇总 public static double Sale_Total(Sale_Filter filter) { //查询该店铺订单的销售金额 List <SqlParameter> sp = new List <SqlParameter>(); string where = "OrderStatus=99 AND Receivablesamount>0 " + Sale_GetWhere(filter, sp); return(DataConvert.CDouble(DBCenter.ExecuteScala("ZL_Order_PayedView", "SUM(Receivablesamount)", where, "", sp))); }
public VM_Product(M_Product proMod, HttpRequestBase Request) { groupList = JsonConvert.SerializeObject(DBCenter.SelWithField("ZL_Group", "GroupID,GroupName")); gpriceDT = gpBll.GetGroupList(); gpriceDT.Columns.Add(new DataColumn("gprice", typeof(string))); fareDT = fareBll.Sel(); this.proMod = proMod; if (proMod.ID > 0) { this.NodeID = proMod.Nodeid; this.ModelID = proMod.ModelID; this.ProGuid = proMod.ID.ToString(); //会员组价 if (proMod.UserType == 2 && proMod.UserPrice.Contains("[") && !proMod.UserPrice.Equals("[]")) { DataTable upDT = JsonConvert.DeserializeObject <DataTable>(proMod.UserPrice); foreach (DataRow dr in upDT.Rows) { DataRow[] drs = gpriceDT.Select("GroupID='" + dr["gid"] + "'"); if (drs.Length > 0) { drs[0]["gprice"] = DataConvert.CDouble(dr["price"]).ToString("F2"); } } } //捆绑商品 if (!string.IsNullOrEmpty(proMod.BindIDS)) { DataTable dt = proBll.SelByIDS(proMod.BindIDS, "id,Thumbnails,Proname,LinPrice"); bindList = JsonConvert.SerializeObject(dt); } if (!string.IsNullOrEmpty(proMod.TableName)) { DataTable valueDT = proBll.Getmodetable(proMod.TableName.ToString(), proMod.ItemID); if (valueDT != null && valueDT.Rows.Count > 0) { modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT }); } } } else { this.NodeID = DataConvert.CLng(Request.QueryString["NodeID"]); this.ModelID = DataConvert.CLng(Request.QueryString["ModelID"]); this.ProGuid = System.Guid.NewGuid().ToString(); this.proMod.ProCode = B_Product.GetProCode(); modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.Admin }); } nodeMod = nodeBll.SelReturnModel(NodeID); }
protected void Pro_RPT_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //如果变复杂,将其分离为局部页 if (e.Item.ItemIndex == 0)//首行判断 { DataRowView dr = e.Item.DataItem as DataRowView; M_Payment payMod = OrderHelper.GetPaymentByOrderNo(dr.Row); int count = OrderDT.Select("id=" + dr["ID"]).Length; string html = ""; //收货人 html += "<td class='td_l rowtd' rowspan='" + count + "'>"; html += "<i class='fa fa-user'></i> <a href='OrderList.aspx?UserID=" + dr["UserID"] + "' title='按用户筛选'>" + B_User.GetUserName(dr["HoneyName"], dr["AddUser"]) + "</a>"; html += "(<a href='javascript:;' onclick='user.showuinfo(" + dr["UserID"] + ");' title='查看用户信息'><span style='color:green;'>" + dr["UserID"] + "</span></a>)"; html += "</td>"; //金额栏 html += "<td class='td_l rowtd' rowspan='" + count + "' style='font-size:12px;'>总计:<i class='fa fa-rmb'></i> " + Convert.ToDouble(dr["OrdersAmount"]).ToString("f2") + "<br />"; string _paytypeHtml = OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.PayType); if (!string.IsNullOrEmpty(_paytypeHtml)) { _paytypeHtml = _paytypeHtml + "<br />"; } html += _paytypeHtml; html += "<div>商品:" + (DataConvert.CDouble(dr["OrdersAmount"]) - DataConvert.CDouble(dr["Freight"])).ToString("F2") + "</div>"; html += "<div>运费:" + DataConvert.CDouble(dr["Freight"]).ToString("F2") + "</div>"; html += "<div title='优惠卷'>优惠:" + payMod.ArriveMoney.ToString("F2") + "</div>"; html += "<div>积分:" + payMod.UsePointArrive.ToString("f2") + "(" + payMod.UsePoint.ToString("F0") + ")</div>"; html += "<div style='color:#d9534f;'>需付:" + payMod.MoneyReal.ToString("F2") + "</div>"; if (!string.IsNullOrEmpty(DataConvert.CStr(dr["PaymentNo"]))) { string plat = platBll.GetPayPlatName(DataConvert.CStr(dr["PaymentNo"])); html += "<a href='" + StrHelper.Url_AddParam(Request.RawUrl, "filter=paid") + "' title='筛选已付款订单'>" + "<span style='color:#337ab7;'>" + plat + "</span>" + "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")</a>"; } else { html += "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")"; } html += "</td>"; //订单状态 html += "<td class='td_md rowtd' rowspan='" + count + "'><span class='gray9'>" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Order) + "</span> <br />"; int ordertype = DataConvert.CLng(dr["OrderType"]); //非旅游与酒店订单,则显示快递信息 int expid = DataConvert.CLng(dr["ExpressNum"]); if (ordertype != 7 && ordertype != 9) { html += "<a href='javascript:;' class='expview_a' data-expid='" + expid + "' id='expview_" + dr["ID"] + "_a' onclick=\"exp.apilink(this,'" + expid + "');\">" + OrderHelper.GetExpStatus(Convert.ToInt32(dr["StateLogistics"])) + "</span> <br/>"; } html += "</td>"; //操作栏 html += "<td class='td_md rowtd' rowspan='" + count + "'><a href='OrderListInfo.aspx?ID=" + dr["ID"] + "' class='order_bspan'>订单详情</a><br/>" + Getoperator(dr) + "</td>"; (e.Item.FindControl("Order_Lit") as Literal).Text = html; } } }
private void MyBind() { DataTable dt = Report_SelByClass(STime, ETime); RPT.DataSource = dt; RPT.DataBind(); //PayOnline_L.Text = DataConvert.CDouble(dt.Compute("SUM(pay_online)", "")).ToString("F2"); //PayPurse_L.Text = DataConvert.CDouble(dt.Compute("SUM(pay_purse)", "")).ToString("F2"); TotalSale_L.Text = DataConvert.CDouble(dt.Compute("SUM(ALLMoney)", "")).ToString("F2"); }
//订单数,客单价,消费总额 public static Sale_Result Sale_Order_Count(Sale_Filter filter) { Sale_Result result = new Sale_Result(); List <SqlParameter> sp = new List <SqlParameter>(); string where = "1=1 " + Sale_GetWhere(filter, sp); result.count = DBCenter.Count("ZL_Order_PayedView", where, sp); result.sales = DataConvert.CDouble(DBCenter.ExecuteScala("ZL_Order_PayedView", "SUM(Receivablesamount)", where, "", sp)); return(result); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = buser.GetLogin(); M_Shop_Bonus bnMod = new M_Shop_Bonus(); DataTable dt = JsonConvert.DeserializeObject <DataTable>(Data_Hid.Value); if (Mid > 0) { bnMod = bnBll.SelReturnModel(Mid); } bnMod.Alias = Alias_T.Text.Trim(); bnMod.IsDefault = IsDefault_Chk.Checked ? 1 : 0; bnMod.ParentID = 0; bnMod.Remark = Remark_T.Text; bnMod.BonusType = Convert.ToInt32(dt.Rows[0]["BonusType"]); bnMod.BonusValue1 = DataConvert.CDouble(dt.Rows[0]["BonusValue1"]).ToString("F2"); if (bnMod.IsDefault == 1) { DBCenter.UpdateSQL(bnMod.TbName, "IsDefault=0", "IsDefault=1"); } if (bnMod.ID > 0) { bnBll.UpdateByID(bnMod); } else { bnMod.StoreID = mu.SiteID; bnMod.ID = bnBll.Insert(bnMod); } //更新子类目信息 if (dt.Rows.Count > 1) { string ids = StrHelper.GetIDSFromDT(dt, "ID"); DBCenter.DelByWhere(bnMod.TbName, "ID NOT IN (" + ids + ") AND ParentID=" + bnMod.ID); for (int i = 1; i < dt.Rows.Count; i++) { //为防止信息修改,增加店铺验证 DataRow dr = dt.Rows[i]; M_Shop_Bonus model = new M_Shop_Bonus().GetModelFromReader(dr); model.ParentID = bnMod.ID; model.StoreID = bnMod.StoreID; if (model.ID > 0) { bnBll.UpdateByID(model); } else { model.ID = bnBll.Insert(model); } } } function.WriteSuccessMsg("操作成功", "Bonus.aspx"); }
/// <summary> /// 1,根据提供的消费数据,递归按用户生成二叉树消费链表,并计算出提成 /// 2,该方法用于提供后面所需要的逻辑判断的所有数据 /// </summary> /// <param name="dt">需要统计的消费数据:ZL_User_Consume</param> /// <param name="pmodel">父模型,可使用一个空的UserID为零的模型,以此作为根</param> /// <return>pmodel中的是自己的层级链表,unitList是全数据链接,用于筛选等逻辑</return> public void CreateTree(DataTable dt, M_User_UnitWeek pmodel) { DataRow[] child = null; if (pmodel.UserID > 0) { child = dt.Select("ParentUserID='" + pmodel.UserID + "'"); } else { //无推荐人 child = dt.Select("ParentUserID='' OR ParentUserID IS Null OR ParentUserID='0'"); } foreach (DataRow dr in child) { //返回如下的几个值,金额和分红,子用户详情 M_User_UnitWeek model = new M_User_UnitWeek() { CDate = pmodel.CDate }; model.UserID = Convert.ToInt32(dr["UserID"]); model.UserName = DataConvert.CStr(dr["UserName"]); model.PUserID = DataConvert.CLng(dr["ParentUserID"]); model.AMount = DataConvert.CDouble(dr["AMount"]); //不能用Clng否转换失败 model.GroupID = Convert.ToInt32(dr["GroupID"]); model.Level = (pmodel.Level + 1); //注意对用户来说是相对,而不是绝对的 model.PModel = pmodel; CreateTree(dt, model); //递归树顶,从树顶回朔运算 //不需要统计业绩金额,每层都回朔 //pmodel.ChildAMount += model.AMount + model.ChildAMount;//业绩金额汇总 //-------本级可用于提成的金额汇总(需计算后才是真正的提成) //pmodel.ChildUnit0 += model.AMount + model.Unit0; //pmodel.ChildUnit10 += model.Unit10; //pmodel.ChildUnit20 += model.Unit20; //pmodel.ChildUnit30 += model.Unit30; //pmodel.ChildIDS += model.UserID + "," + model.ChildIDS; model.ChildIDS = "";//下级所有子用户IDS //-------下级子会员组别统计(存入GroupID) //pmodel.ChildGroupIDS = Arr_Merge(pmodel.ChildGroupIDS, model.ChildGroupIDS, model.GroupID); //-------其他 pmodel.child.Add(model); unitList.Add(model); }//二叉树 end; #region 提成计算区 if (pmodel.AMount > 0) { CountUnit(pmodel, pmodel.PModel); } #endregion if (pmodel != null)//插入提成记录,用户 { //unitWeekBll.Insert(pmodel); //sumBll.UpdateUnit(pmodel, percent, pmodel.CDate); } }
private void MyBind() { string fields = "ID,OrderNo,AddUser,AddTime,StoreID,PaymentStatus,OrderType,OrderStatus,OrderMessage,ExpressNum,ParentUserID,UserID,HoneyName,ExpSTime"; DataTable dt = OrderDT.DefaultView.ToTable(true, fields.Split(',')); Order_RPT.DataSource = dt; Order_RPT.DataBind(); Skey_T.Text = Skey; empty_div.Visible = dt.Rows.Count < 1; TotalSum_Hid.Value = DataConvert.CDouble(OrderDT.Compute("SUM(ordersamount)", "")).ToString("f2"); //function.Script(this, "CheckOrderType('" + Filter + "')"); }
/// <summary> /// DataRowView.Row /// </summary> public static string GetStatus(DataRow dr, TypeEnum type) { M_OrderList orderMod = new M_OrderList(); orderMod.Paymentstatus = Convert.ToInt32(dr["Paymentstatus"]); orderMod.OrderStatus = Convert.ToInt32(dr["OrderStatus"]); orderMod.StateLogistics = Convert.ToInt32(dr["StateLogistics"]); orderMod.Aside = Convert.ToInt32(dr["Aside"]); orderMod.PayType = Convert.ToInt32(dr["Delivery"]); orderMod.PreMoney = DataConvert.CDouble(dr["Service_charge"]); return(GetStatus(orderMod, type)); }
public void MyBind() { M_UserInfo mu = buser.GetLogin(); M_CommonData storeMod = conBll.SelMyStore_Ex(); int quick = Convert.ToInt32(QuickSearch_DP.SelectedValue); int skeyType = Convert.ToInt32(SkeyType_DP.SelectedValue); DataTable dt = orderBll.SearchByQuickAndSkey(OrderType.ToString(), OrderStatus, PayStatus, quick, skeyType, Skey_T.Text, storeMod.GeneralID); TotalSum_Hid.Value = DataConvert.CDouble(dt.Compute("SUM(ordersamount)", "")).ToString("f2"); Store_RPT.DataSource = dt; Store_RPT.DataBind(); }
protected void Pro_RPT_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //如果变复杂,将其分离为局部页 if (e.Item.ItemIndex == 0)//首行判断 { DataRowView dr = e.Item.DataItem as DataRowView; M_Payment payMod = OrderHelper.GetPaymentByOrderNo(dr.Row); int count = OrderDT.Select("id=" + dr["ID"]).Length; string html = ""; //收货人 html += "<td class='td_l rowtd' rowspan='" + count + "'>"; html += "<div>会员:<a href='javascript:;'>" + dr["rename"] + "</a></div>"; html += "<div>收银:<a href='javascript:;'>" + dr["AddUser"] + "</a></div>"; //html += "<i class='fa fa-user'></i> <a href='OrderList.aspx?UserID=" + dr["UserID"] + "' title='按用户筛选'>" + B_User.GetUserName(dr["HoneyName"], dr["AddUser"]) + "</a>"; //html += "(<a href='javascript:;' onclick='user.showuinfo(" + dr["UserID"] + ");' title='查看用户信息'><span style='color:green;'>" + dr["UserID"] + "</span></a>)"; html += "</td>"; //金额栏 html += "<td class='td_l rowtd' rowspan='" + count + "' style='font-size:12px;'>总计:<i class='fa fa-rmb'></i> " + Convert.ToDouble(dr["OrdersAmount"]).ToString("f2") + "<br />"; string _paytypeHtml = OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.PayType); if (!string.IsNullOrEmpty(_paytypeHtml)) { _paytypeHtml = _paytypeHtml + "<br />"; } html += _paytypeHtml; html += "<div>商品:" + (DataConvert.CDouble(dr["OrdersAmount"]) - DataConvert.CDouble(dr["Freight"])).ToString("F2") + "</div>"; //html += "<div>运费:" + DataConvert.CDouble(dr["Freight"]).ToString("F2") + "</div>"; html += "<div title='优惠券'>优惠:" + payMod.ArriveMoney.ToString("F2") + "</div>"; //html += "<div>积分:" + payMod.UsePointArrive.ToString("f2") + "(" + payMod.UsePoint.ToString("F0") + ")</div>"; html += "<div style='color:#d9534f;'>需付:" + payMod.MoneyReal.ToString("F2") + "</div>"; if (!string.IsNullOrEmpty(DataConvert.CStr(dr["PaymentNo"]))) { string plat = ExOrder.ShowPayPlatName(DataConvert.CLng(dr["PayPlatID"])); html += "<span style='color:#337ab7;'>" + plat + "</span>" + "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")</a>"; } else { html += "(" + OrderHelper.GetStatus(dr.Row, OrderHelper.TypeEnum.Pay) + ")"; } html += "</td>"; //订单状态 //html += "<td class='td_md rowtd' rowspan='" + count + "'>"; //int ordertype = DataConvert.CLng(dr["OrderType"]); //html += "</td>"; //操作栏 html += "<td class='td_md rowtd' rowspan='" + count + "'>" + Getoperator(dr) + "</td>"; (e.Item.FindControl("Order_Lit") as Literal).Text = html; } } }
public string GetPrice() { double price = DataConvert.CDouble(Eval("Price")); if (price == 0) { return("免费"); } else { return(price.ToString("f2")); } }
protected void Save_Btn_Click(object sender, EventArgs e) { M_Design_Tlp tlpMod = new M_Design_Tlp(); if (Mid > 0) { tlpMod = tlpBll.SelReturnModel(Mid); } string oldimg = tlpMod.PreviewImg; tlpMod.TlpName = TlpName_T.Text; tlpMod.Price = DataConvert.CDouble(Price_T.Text); tlpMod.Remind = Remind_T.Text; tlpMod.ClassID = DataConvert.CLng(Node_Hid.Value); tlpMod.ZStatus = DataConvert.CLng(Request.Form["zstatus_rad"]); tlpMod.Score = DataConvert.CDouble(Request.Form["score_num"]); tlpMod.ZType = ZType; tlpMod.DefBy = Request.Form["defby_chk"]; if (!PreView_UP.FVPath.Equals(tlpMod.PreviewImg, StringComparison.CurrentCultureIgnoreCase)) { if (PreView_UP.HasFile) { tlpMod.PreviewImg = PreView_UP.SaveFile(); } else { tlpMod.PreviewImg = PreView_UP.FVPath; } } if (Mid > 0) { if (!tlpMod.PreviewImg.Equals(oldimg)) { M_Design_Page pageMod = pageBll.SelModelByTlp(tlpMod.ID); pageMod.PreviewImg = tlpMod.PreviewImg; pageBll.UpdateByID(pageMod); } tlpBll.UpdateByID(tlpMod); } else { tlpMod.ID = tlpBll.Insert(tlpMod); //添加一个新的场景 M_Design_Page pageMod = new M_Design_Page(); pageMod.TlpID = tlpMod.ID; pageMod.ZType = 1; pageMod.PreviewImg = tlpMod.PreviewImg; pageBll.Insert(pageMod); } function.WriteSuccessMsg("操作成功", "TlpList.aspx?type=" + ZType); }