private void RptBind(string _strWhere, string _goodsby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.customer_id > 0) { ddlCustomer.SelectedValue = customer_id.ToString(); } if (this.goods_id > 0) { ddlGoods.SelectedValue = goods_id.ToString(); } if (this.vehicle_id > 0) { ddlVehicle.SelectedValue = vehicle_id.ToString(); } txtBeginTime.Text = this.beginTime; txtEndTime.Text = this.endTime; txtKeyWord.Text = this.keywords; BLL.CheckRecord bll = new BLL.CheckRecord(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _goodsby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("check_record_list.aspx", "customer_id={0}&goods_id={1}&vehicle_id={2}&beginTime={3}&endTime={4}&keywords={5}&page={6}", this.customer_id.ToString(), this.goods_id.ToString(), this.vehicle_id.ToString(), this.beginTime.ToString(), this.endTime, this.keywords.ToString(), "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void ShowInfo(int _id) { BLL.CheckRecord bll = new BLL.CheckRecord(); Model.CheckRecord model = bll.GetModel(_id); ddlCustomer.SelectedValue = model.CustomerId.ToString(); GoodsBind(model.CustomerId); ddlGoods.SelectedValue = model.GoodsId.ToString(); ddlVehicle.SelectedValue = model.VehicleId.ToString(); ddlHandlingMode.SelectedValue = model.HandlingModeId.ToString(); txtCheckTime.Text = model.CheckTime.ToString("yyyy-MM-dd"); txtInspectionNumber.Text = model.InspectionNumber; txtCaseNumber.Text = model.CaseNumber; txtCheckResult.Text = model.CheckResult; txtRealName.Text = model.RealName; txtLinkTel.Text = model.LinkTel; txtAdmin.Text = model.Admin; txtRemark.Text = model.Remark; BLL.CheckCost checkCostBLL = new BLL.CheckCost(); DataTable checkCostDT = checkCostBLL.GetList(" CheckRecordId = " + _id + "").Tables[0]; this.rptCostList.DataSource = checkCostDT; this.rptCostList.DataBind(); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("check_record", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.CheckRecord bll = new BLL.CheckRecord(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除查验记录成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("check_record_list.aspx", "customer_id={0}&goods_id={1}&beginTime={2}&endTime={3}", this.customer_id.ToString(), this.goods_id.ToString(), this.beginTime.ToString(), this.endTime)); }
private bool DoEdit(int _id) { bool result = false; BLL.CheckRecord bll = new BLL.CheckRecord(); Model.CheckRecord model = bll.GetModel(_id); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.GoodsId = int.Parse(ddlGoods.SelectedValue); model.VehicleId = int.Parse(ddlVehicle.SelectedValue); model.HandlingModeId = int.Parse(ddlHandlingMode.SelectedValue); model.InspectionNumber = txtInspectionNumber.Text; model.CaseNumber = txtCaseNumber.Text; model.CheckResult = txtCheckResult.Text; model.RealName = txtRealName.Text; model.LinkTel = txtLinkTel.Text; model.CheckTime = DateTime.Parse(txtCheckTime.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 0; model.CreateTime = DateTime.Now; #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddCheckCost(new CheckCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改查验记录信息:" + model.Id); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = false; Model.CheckRecord model = new Model.CheckRecord(); BLL.CheckRecord bll = new BLL.CheckRecord(); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.GoodsId = int.Parse(ddlGoods.SelectedValue); model.VehicleId = int.Parse(ddlVehicle.SelectedValue); model.HandlingModeId = int.Parse(ddlHandlingMode.SelectedValue); model.InspectionNumber = txtInspectionNumber.Text; model.CaseNumber = txtCaseNumber.Text; model.CheckResult = txtCheckResult.Text; model.RealName = txtRealName.Text; model.LinkTel = txtLinkTel.Text; model.CheckTime = DateTime.Parse(txtCheckTime.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 0; model.CreateTime = DateTime.Now; #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddCheckCost(new CheckCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加查验记录:" + model.Id); //记录日志 result = true; } return result; }