public void Bind() { string msg = Main.Menu.First(x => x.id == iden).name.Replace("数据映射", ""); switch (BinType) { case 0: groupBox1.Text = "价格管理(" + msg + ")"; break; default: groupBox1.Text = "价格管理(" + msg + ")"; break; } soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); var li = bll.GetMaptoolList(PageSize, PageIndex, order, orderField, like, whereField, sqlext, BinType, Login.authKey, this.iden); if (li != null) { //#region 货源2.0新增内容(销售单位,用于控制商城前台销售商品的可售单位(最小单位、中包装、件装)) li.Tables[0].Columns.Add("st", typeof(string)); //#endregion var dt = li.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { //动态添加价格类型 string ID = dt.Rows[i]["ID"].ToString(); DataTable PriceTable = bll.GetPriceByID(ID); if (PriceTable != null && PriceTable.Rows.Count > 0) { foreach (DataRow dr in PriceTable.Rows) { string tempcategory = dr["category"] == null ? string.Empty : dr["category"].ToString(); decimal tempprice = dr["price_n"] == null ? 0 : Convert.ToDecimal(dr["price_n"]); //添加新列 if (!dt.Columns.Contains(tempcategory)) { dt.Columns.Add(tempcategory, typeof(string)); if (!dataGridViewX1.Columns.Contains(tempcategory)) { dataGridViewX1.Columns.Insert(13, new DataGridViewTextBoxColumn() { HeaderText = tempcategory, DataPropertyName = tempcategory, Name = tempcategory }); } } dt.Rows[i][tempcategory] = tempprice; } } } dataGridViewX1.DataSource = dt; recordCount = int.Parse(li.Tables[1].Rows[0]["recordCount"].ToString()); pageCount = int.Parse(li.Tables[1].Rows[0]["pageCount"].ToString()); paginger(); labelX1.Text = string.Format("共{0}条记录", recordCount); } else { MessageBox.Show("您的登陆状态已经失效,请关闭后重新登陆!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Bind() { soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); var li = bll.GetPriceByID(ERP_ID); if (li != null && li.Rows.Count > 0) { li.Columns.Add("Price_Sale", typeof(string)); decimal Price = 0; decimal Price_Plus = 0; foreach (DataRow item in li.Rows) { Price = item["Price"] != null?Convert.ToDecimal(item["Price"]) : 0; Price_Plus = item["Price_Plus"] != null?Convert.ToDecimal(item["Price_Plus"]) : 0; item["Price_Sale"] = Math.Round(Price * Price_Plus, 2); item["Price_Plus"] = Math.Round(Price_Plus, 2); } dataGridViewX1.DataSource = li; } }
public void Bind() { string msg = "商城数据"; switch (BinType) { case 0: groupBox1.Text = "全部数据(" + msg + ")"; break; case 1: groupBox1.Text = "未映射数据(" + msg + ")"; break; case 2: groupBox1.Text = "已映射数据(" + msg + ")"; break; } soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); var li = bll.GetShopList(PageSize, PageIndex, order, orderField, like, whereField, sqlext, BinType, Login.authKey, iden); if (BinType == 1) { dataGridViewX1.Columns["sup"].Visible = false; } else { dataGridViewX1.Columns["sup"].Visible = true; } if (li != null) { //取商品流向设置 DataTable lx = bll.GetLiuXiangList(Login.authKey); var dt = li.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { //动态添加价格类型 string ID = dt.Rows[i]["spid"].ToString(); DataTable PriceTable = bll.GetPriceByID(ID); if (PriceTable != null && PriceTable.Rows.Count > 0) { foreach (DataRow dr in PriceTable.Rows) { string tempcategory = dr["category"] == null ? string.Empty : dr["category"].ToString(); decimal tempprice = dr["price_n"] == null ? 0 : Convert.ToDecimal(dr["price_n"]); //添加新列 if (!dt.Columns.Contains(tempcategory)) { dt.Columns.Add(tempcategory, typeof(string)); if (!dataGridViewX1.Columns.Contains(tempcategory)) { dataGridViewX1.Columns.Insert(13, new DataGridViewTextBoxColumn() { HeaderText = tempcategory, DataPropertyName = tempcategory, Name = tempcategory }); } } dt.Rows[i][tempcategory] = tempprice; } } } dataGridViewX1.DataSource = dt; recordCount = int.Parse(li.Tables[1].Rows[0]["recordCount"].ToString()); pageCount = int.Parse(li.Tables[1].Rows[0]["pageCount"].ToString()); paginger(); labelX1.Text = string.Format("共{0}条记录", recordCount); } else { MessageBox.Show("您的登陆状态已经失效,请关闭后重新登陆!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Bind() { string msg = Main.Menu.First(x => x.id == iden).name.Replace("数据映射", ""); switch (BinType) { case 0: groupBox1.Text = "全部数据(" + msg + ")"; break; case 1: groupBox1.Text = "未映射数据(" + msg + ")"; break; case 2: groupBox1.Text = "已映射数据(" + msg + ")"; break; } if (BinType != 1) { dataGridViewX1.Columns["Column2"].Visible = false; } soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); var li = bll.GetMaptoolList(PageSize, PageIndex, order, orderField, like, whereField, sqlext, BinType, Login.authKey, this.iden); if (li != null) { var dt = li.Tables[0]; dt.Columns.Add("s", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++) { if (Library.Lang.DataValidator.isNumber(dt.Rows[i]["Linkid"])) { dt.Rows[i]["s"] = "已映射"; } else { dt.Rows[i]["s"] = "未映射"; } //动态添加价格类型 string ID = dt.Rows[i]["ID"].ToString(); DataTable PriceTable = bll.GetPriceByID(ID); if (PriceTable != null && PriceTable.Rows.Count > 0) { foreach (DataRow dr in PriceTable.Rows) { string tempcategory = dr["category"] == null ? string.Empty : dr["category"].ToString(); decimal tempprice = dr["price"] == null ? 0 : Convert.ToDecimal(dr["price"]); //添加新列 if (!dt.Columns.Contains(tempcategory)) { dt.Columns.Add(tempcategory, typeof(string)); if (!dataGridViewX1.Columns.Contains(tempcategory)) { dataGridViewX1.Columns.Insert(13, new DataGridViewTextBoxColumn() { HeaderText = tempcategory, DataPropertyName = tempcategory, Name = tempcategory }); } } dt.Rows[i][tempcategory] = tempprice; } } } dataGridViewX1.DataSource = dt; recordCount = int.Parse(li.Tables[1].Rows[0]["recordCount"].ToString()); pageCount = int.Parse(li.Tables[1].Rows[0]["pageCount"].ToString()); paginger(); labelX1.Text = string.Format("共{0}条记录", recordCount); } else { MessageBox.Show("您的登陆状态已经失效,请关闭后重新登陆!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } }