public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int pageIndex = -1, pageSize = -1,order=0,type=-1; int.TryParse(context.Request["pIndex"], out pageIndex); int.TryParse(context.Request["pSize"], out pageSize); int.TryParse(context.Request["order"],out order); int.TryParse(context.Request["type"], out type); if (pageIndex<=0||pageSize<=0) { context.Response.Write("error"); return; } try { List<Model.Item> items = null; if (type <= 0) { items = new BLL.ItemBLL().SelectPageList(pageIndex, order > 0 ? true : false, pageSize); } else { items = new BLL.ItemBLL().SelectPageListByCategory(type, pageIndex, pageSize, order > 0 ? true : false); } string jsons = Common.ConverterHelper.ObjectToJson(items); context.Response.Write(jsons); } catch (Exception ex) { context.Response.Write("error"); new Common.LogHelper(typeof(LoadImagesHandler)).Error(ex); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int itemId = -1; int.TryParse(context.Request["id"], out itemId); if (itemId <= 0) { context.Response.Write("error"); return; } string action = context.Request["action"]; try { BLL.ItemBLL helper = new BLL.ItemBLL(); Model.Item item = null; if (action == "next") { item = helper.SelectNext(itemId); } else { item = helper.SelectPrevious(itemId); } if (item != null) { context.Response.Write(item.ItemPath); } } catch (Exception ex) { context.Response.Write("error"); new Common.LogHelper(typeof(GetItemHandler)).Error(ex); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.ItemBLL helper = new BLL.ItemBLL(); //判断Session,验证权限 if (context.Session["User"] != null) { int id = -1; int.TryParse(context.Request["id"], out id); if (id > 0) { string path = context.Server.MapPath(helper.Select(id).ItemPath); if (helper.Delete(id)) { try { System.IO.File.Delete(path); } catch (System.Exception) { new Common.LogHelper(typeof(DeleteNewsHandler)).Error("文件删除失败"); } context.Response.Write("true"); context.Response.End(); } } context.Response.Write("false"); } else { context.Response.Write("no permission!"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //Model.FormatModel.JsonMsgModel jsonMsg; int id = -1; int.TryParse(context.Request["id"],out id); if (id<=0) { //jsonMsg = new Model.FormatModel.JsonMsgModel() { BackupUrl = context.Request.UrlReferrer.ToString(), Msg = "error", Status = Model.FormatModel.JsonMsgStatus.error }; context.Response.Write("error"); context.Response.End(); return; } try { Model.Item news = new BLL.ItemBLL().Select(id); //jsonMsg = new Model.FormatModel.JsonMsgModel() { BackupUrl = context.Request.UrlReferrer.ToString(), Data = news, Msg = "success", Status = Model.FormatModel.JsonMsgStatus.ok }; string jsonData = Common.ConverterHelper.ObjectToJson(news); context.Response.Write(jsonData); } catch (System.Exception) { context.Response.Write("error"); } }
private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row) { if (isSelect) { return; } if (column_name == "item_subno") { if (string.IsNullOrEmpty(row[column_name].ToString())) { return; } IBLL.IItem itembll = new BLL.ItemBLL(); DataTable tb = itembll.GetLikeItem("", 0, row["item_subno"].ToString(), "0"); if (tb.Rows.Count > 1) { SelectRow(row, row["item_subno"].ToString()); } else { foreach (DataRow dr in tb.Rows) { int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["valid_price"] = dr["price"]; dgv_dr["sub_amount"] = Helper.Conv.ToDecimal(dgv_dr["in_qty"]) * Helper.Conv.ToDecimal(dgv_dr["valid_price"]); Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); break; } if (tb.Rows.Count < 1) { row[column_name] = ""; } } if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString())) { this.editGrid1.DataSource.Rows.Add(); } } else if (column_name == "in_qty" || column_name == "valid_price") { row["sub_amount"] = Helper.Conv.ToDecimal(row["in_qty"]) * Helper.Conv.ToDecimal(row["valid_price"]); editGrid1.Refresh(); } }
private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row) { if (isSelect) { return; } if (column_name == "item_subno") { if (string.IsNullOrEmpty(row[column_name].ToString())) { return; } IBLL.IPriceBLL pricebll = new BLL.PriceBLL(); IBLL.IItem itembll = new BLL.ItemBLL(); DataTable tb = itembll.GetLikeItem("", 3, row["item_subno"].ToString(), "0"); if (tb.Rows.Count > 1) { SelectRow(row, row["item_subno"].ToString()); } else { foreach (DataRow dr in tb.Rows) { int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["old_price"] = dr["base_price"]; dgv_dr["old_price2"] = dr["base_price2"]; dgv_dr["old_price3"] = dr["base_price3"]; Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); break; } if (tb.Rows.Count < 1) { row[column_name] = ""; } } if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString())) { this.editGrid1.DataSource.Rows.Add(); } } }
private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row) { if (isSelect) { return; } if (column_name == "item_subno") { if (string.IsNullOrEmpty(row[column_name].ToString())) { return; } IBLL.IPriceBLL pricebll = new BLL.PriceBLL(); IBLL.IItem itembll = new BLL.ItemBLL(); var sup_id = txt_sup.Text.Trim().Split('/')[0]; DataTable tb = itembll.GetLikeItem(sup_id, 1, row["item_subno"].ToString(), "0"); if (tb.Rows.Count > 1) { SelectRow(row, row["item_subno"].ToString()); } else { foreach (DataRow dr in tb.Rows) { Conv.CopyDataRow(row, dr); row["discount"] = "1"; row["in_price"] = pricebll.GetSupItemPrice(sup_id, dr["item_no"].ToString(), "0"); row["sub_amount"] = Helper.Conv.ToDecimal(row["order_qnty"]) * Helper.Conv.ToDecimal(row["in_price"]) * Helper.Conv.ToDecimal(row["discount"]); break; } if (tb.Rows.Count < 1) { row[column_name] = ""; } } if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString())) { this.editGrid1.DataSource.Rows.Add(); } } else if (column_name == "in_price" || column_name == "order_qnty" || column_name == "discount") { row["sub_amount"] = Helper.Conv.ToDecimal(row["order_qnty"]) * Helper.Conv.ToDecimal(row["in_price"]) * Helper.Conv.ToDecimal(row["discount"]); editGrid1.Refresh(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int id = int.Parse(context.Request["id"]); if (id<=0) { return; } try { List<Model.Item> items = new BLL.ItemBLL().SelectOdd(id, 9); string jsons = Common.ConverterHelper.ObjectToJson(items); context.Response.Write(jsons); } catch (Exception ex) { context.Response.Write("error"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int itemId = -1; int.TryParse(context.Request["id"], out itemId); if (itemId<=0) { context.Response.Write("error"); return; } BLL.ItemBLL helper = new BLL.ItemBLL(); if (helper.AddFav(itemId)) { context.Response.Write("true"); } else { context.Response.Write("error"); } }
public void SelectRow(DataRow row, string condition = "") { frmSelect frm = new frmSelect(); frm.dgv.AddColumn("选择", "选择", "", 40, 2, "{0:,1:√}"); frm.dgv.AddColumn("item_subno", "货号", "", 110, 1, ""); frm.dgv.AddColumn("barcode", "条码", "", 110, 1, ""); frm.dgv.AddColumn("item_name", "商品名称", "", 160, 1, ""); frm.dgv.AddColumn("item_subname", "拼音码", "", 90, 1, ""); frm.dgv.AddColumn("unit_no", "单位", "", 60, 1, ""); frm.dgv.AddColumn("item_size", "规格", "", 60, 1, ""); frm.dgv.AddColumn("price", "价格", "", 100, 3, "0.00"); frm.dgv.AddColumn("product_area", "产地", "", 150, 1, ""); frm.Text = "选择商品"; frm.condition = condition; List <DataRow> lis = frm.SelectDataRow("货号:", "item_subno"); int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } if (lis.Count > 1) { for (int i = 0; i < lis.Count - 1; i++) { this.editGrid1.DataSource.Rows.InsertAt(this.editGrid1.DataSource.NewRow(), index); } } IBLL.IItem ibll = new BLL.ItemBLL(); Dictionary <string, decimal> stock_dic = ibll.GetItemStock(this.txtbranch.Text.Split('/')[0]); foreach (DataRow dr in lis) { var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["valid_price"] = dr["price"]; dgv_dr["sub_amount"] = Helper.Conv.ToDecimal(dgv_dr["in_qty"]) * Helper.Conv.ToDecimal(dgv_dr["valid_price"]); decimal stock_qty = 0; stock_dic.TryGetValue(dgv_dr["item_no"].ToString(), out stock_qty); dgv_dr["stock_qty"] = stock_qty; Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); index++; } if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString())) { this.editGrid1.DataSource.Rows.Add(); } this.editGrid1.Editing = false; this.editGrid1.Refresh(); }
private void LoadItem() { string keyword = this.txtKeyword.Text.Trim(); DataTable dt = new DataTable(); if (this.op_type == "1") { //商品 IBLL.IItem bll = new BLL.ItemBLL(); dt = bll.QuickSearchList(keyword); if (dt.Rows.Count == 0) { } else if (dt.Rows.Count == 1) { this.item_no = dt.Rows[0]["item_subno"].ToString(); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } else if (this.op_type == "2") { //客户 IBLL.ICus bll = new BLL.CusBLL(); dt = bll.QuickSearchList(keyword); if (dt.Rows.Count == 1) { this.item_no = dt.Rows[0]["supcust_no"].ToString(); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } else if (this.op_type == "3") { //供应商 IBLL.ISup bll = new BLL.SupBLL(); dt = bll.QuickSearchList(keyword); if (dt.Rows.Count == 1) { this.item_no = dt.Rows[0]["supcust_no"].ToString(); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } else if (this.op_type == "4") { //业务员 IBLL.IPeople bll = new BLL.PeopleBLL(); dt = bll.QuickSearchList("02", keyword); if (dt.Rows.Count == 1) { this.item_no = dt.Rows[0]["oper_id"].ToString(); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } else if (this.op_type == "5") { //仓库 IBLL.IBranch bll = new BLL.BranchBLL(); dt = bll.QuickSearchList(keyword); if (dt.Rows.Count == 1) { this.item_no = dt.Rows[0]["branch_no"].ToString(); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } this.dgvItem.DataSource = dt; if (dt.Rows.Count > 0) { this.dgvItem.Focus(); } else { this.txtKeyword.Focus(); } }
private void LoadItem() { Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { string subNo = ""; if (item_info == null) { subNo = new BLL.ItemBLL().GetMaxCode(); } this.Invoke((MethodInvoker) delegate { foreach (Control c in 基础资料.Controls) { if (c is TextBox) { TextBox tb = c as TextBox; if (tb.TextAlign == HorizontalAlignment.Right) { c.Text = "0.0000"; } else { c.Text = ""; } } } if (item_info != null) { txtSubNo.Text = item_info.item_subno; txtItemName.Text = item_info.item_name; txtSubName.Text = item_info.item_subname; var dr = tb_item_cls.Select().Where(r => r["item_clsno"].Equals(item_info.item_clsno)).SingleOrDefault(); if (dr != null) { txtItemCls.Text = item_info.item_clsno + "/" + dr["item_clsname"]; } cbUnitNo.Text = item_info.unit_no; cbCGUnitNo.Text = item_info.order_unit; txtSize.Text = item_info.item_size; txtarea.Text = item_info.product_area; txtPrice.Text = item_info.price.ToString("0.00"); txtBasePrice.Text = item_info.base_price.ToString("0.00"); txtSalePrice.Text = item_info.sale_price.ToString("0.00"); txtItemPack.Text = item_info.item_pack.ToString("0.00"); cbitem_flag.SelectedValue = item_info.item_flag; checkIsStop.Checked = item_info.display_flag.Equals("0"); dr = tb_sup.Select().Where(r => r["supcust_no"].Equals(item_info.sup_no)).SingleOrDefault(); if (dr != null) { txtSup.Text = item_info.sup_no + "/" + dr["sup_name"]; } txtBarcode.Text = item_info.barcode; txtBasePrice2.Text = item_info.base_price2.ToString("0.00"); txtBasePrice3.Text = item_info.base_price3.ToString("0.00"); nudValidDay.Value = item_info.valid_day; IBLL.IItem itemBll = new BLL.ItemBLL(); DataTable branch_tb = itemBll.GetBranchItemList(item_info.item_no, ""); this.dgStock.DataSource = branch_tb; } else { txtSubNo.Text = subNo; if (!string.IsNullOrEmpty(item_clsno)) { var dr = tb_item_cls.Select().Where(r => r["item_clsno"].Equals(item_clsno)).SingleOrDefault(); if (dr != null) { txtItemCls.Text = item_clsno + "/" + dr["item_clsname"]; } } else { txtItemCls.Text = "00/不定"; } } this.Invoke((MethodInvoker) delegate { this.Opacity = 100; }); }); } catch (Exception ex) { LogHelper.writeLog("LoadItem", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
private void LoadItem() { if (!MyLove.PermissionsBalidation(this.Text, "18")) { return; } int cb_index = Conv.ToInt(cb.SelectedValue); string selectedNode = this.tv.SelectedNode == null ? "" : this.tv.SelectedNode.Tag.ToString(); string keyword = this.txtKeyword.Text.Trim(); int stopItem = this.cbShowStopItem.Checked ? 1 : 0; page.PageSize = this.dgvItem.MaxDisplayRowCount(); Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { Cursor.Current = Cursors.WaitCursor; if (cb_index == 1) { IBLL.IItem bll = new BLL.ItemBLL(); page = bll.GetDataTable( selectedNode, keyword, stopItem, page ); } else if (cb_index == 2) { IBLL.IItem bll = new BLL.ItemBLL(); page = bll.GetDataTable_BySup( selectedNode, keyword, stopItem, page ); } else { page.tb = new DataTable(); } var tb = page.tb; tb.Columns.Add("check"); tb.Columns.Add("row_color", typeof(Color)); foreach (DataRow row in tb.Rows) { if (row["display_flag"].ToString() != "1") { row["row_color"] = Color.Red; } } this.Invoke((MethodInvoker) delegate { this.dgvItem.DataSource = tb; this.lblMaxIndex.Text = page.PageMax.ToString(); this.lblIndex.Text = page.PageIndex.ToString(); }); Cursor.Current = Cursors.Default; } catch (Exception ex) { LogHelper.writeLog("LoadItem", "获取商品出错!"); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row) { if (isSelect) { return; } if (column_name == "item_subno") { if (string.IsNullOrEmpty(row[column_name].ToString())) { return; } IBLL.IPriceBLL pricebll = new BLL.PriceBLL(); IBLL.IItem itembll = new BLL.ItemBLL(); var sup_id = this.txt_cust.Text.Trim().Split('/')[0]; DataTable tb = itembll.GetLikeItem(sup_id, 1, row["item_subno"].ToString(), "0"); if (tb.Rows.Count > 1) { SelectRow(row, row["item_subno"].ToString()); } else { foreach (DataRow dr in tb.Rows) { int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["real_price"] = pricebll.GetCustItemPrice(sup_id, dr["item_no"].ToString(), "0"); dgv_dr["sale_money"] = 0.00; Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); break; } if (tb.Rows.Count < 1) { row[column_name] = ""; } } if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString())) { this.editGrid1.DataSource.Rows.Add(); } } else if (column_name == "other3" && row["other3"].ToString() == "1") //赠送 { row["real_price"] = 0; row["sale_money"] = 0; editGrid1.Refresh(); } else if (column_name == "sale_qnty" || column_name == "real_price") { row["sale_money"] = Helper.Conv.ToDecimal(row["real_price"]) * Helper.Conv.ToDecimal(row["sale_qnty"]); editGrid1.Refresh(); } }