/// <summary> /// 将SHOP00记录实体(SubSonic实体)转换为普通的实体(DataAccess.Model.SHOP00) /// </summary> /// <param name="model">SubSonic插件生成的实体</param> /// <returns>DataAccess.Model.SHOP00</returns> public DataAccess.Model.SHOP00 Transform(SHOP00 model) { if (model == null) { return(null); } return(new DataAccess.Model.SHOP00 { Id = model.Id, SHOP_ID = model.SHOP_ID, SHOP_NAME1 = model.SHOP_NAME1, SHOP_NAME2 = model.SHOP_NAME2, SHOP_KIND = model.SHOP_KIND, SHOP_Area_ID = model.SHOP_Area_ID, SHOP_Price_Area = model.SHOP_Price_Area, SHOP_ADD = model.SHOP_ADD, SHOP_TEL = model.SHOP_TEL, SHOP_EMAIL = model.SHOP_EMAIL, SHOP_CONTECT = model.SHOP_CONTECT, SHOP_MEMO = model.SHOP_MEMO, SHOP_STATUS = model.SHOP_STATUS, SHOP_Limited = model.SHOP_Limited, CRT_DATETIME = model.CRT_DATETIME, CRT_USER_ID = model.CRT_USER_ID, MOD_DATETIME = model.MOD_DATETIME, MOD_USER_ID = model.MOD_USER_ID, LAST_UPDATE = model.LAST_UPDATE, STATUS = model.STATUS, }); }
/// <summary> /// 获取指定Id记录 /// </summary> /// <param name="id">主键Id</param> /// <param name="isCache">是否从缓存中读取</param> /// <returns>DataAccess.Model.SHOP00</returns> public DataAccess.Model.SHOP00 GetModel(long id, bool isCache = true) { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //从缓存中获取List var list = GetList(); if (list == null) { return(null); } else { //在List查询指定主键Id的记录 return(list.SingleOrDefault(x => x.Id == id)); } } else { //从数据库中直接读取 var model = SHOP00.SingleOrDefault(x => x.Id == id); if (model == null) { return(null); } else { //对查询出来的实体进行转换 return(Transform(model)); } } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="id">主键Id</param> /// <returns>DataAccess.Model.SHOP00</returns> public DataAccess.Model.SHOP00 GetModelForCache(long id) { try { //从缓存中读取指定Id记录 var model = GetModelForCache(x => x.Id == id); if (model == null) { //从数据库中读取 var tem = SHOP00.SingleOrDefault(x => x.Id == id); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取SHOP00表记录时出现异常", e); return(null); } }
/// <summary> /// 添加与编辑SHOP00记录 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="model">SHOP00表实体</param> /// <param name="content">更新说明</param> /// <param name="isCache">是否更新缓存</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Save(Page page, SHOP00 model, string content = null, bool isCache = true, bool isAddUseLog = true) { try { //保存 model.Save(); //判断是否启用缓存 if (CommonBll.IsUseCache() && isCache) { SetModelForCache(model); } if (isAddUseLog) { if (string.IsNullOrEmpty(content)) { content = "{0}" + (model.Id == 0 ? "添加" : "编辑") + "SHOP00记录成功,ID为【" + model.Id + "】"; } //添加用户访问记录 UseLogBll.GetInstence().Save(page, content); } } catch (Exception e) { var result = "执行SHOP00Bll.Save()函数出错!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } }
/// <summary> /// 根据当前账户,获取所属门店信息 /// </summary> /// <returns></returns> public SHOP00 GetOnlineUserShop() { var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); var shop_id = OlUser.SHOP_ID; var model = new SHOP00(x => x.SHOP_ID == shop_id); return(model); }
/// <summary> /// 添加商品,采购单位未完成,价格取值未完成,税额未完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _TAKEIN_ID = tbxTAKEIN_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_TAKEIN_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("TAKEIN_ID01", _TAKEIN_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", model.Purchase_UNIT); deObject.Add("STD_CONVERT01", model.PROD_CONVERT1); deObject.Add("STD_QUAN01", model.Purchase_QUAN); deObject.Add("STD_PRICE01", model.COST); deObject.Add("Tax01", 0); deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("Item_DISC_Amt01", 0); deObject.Add("MEMO", ""); deObject.Add("BAT_NO", ""); //var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); //string lgname = OlUser.Manager_LoginName; //deObject.Add("CRT_USER_ID1", lgname); //deObject.Add("CRT_DATETIME1", DateTime.Now.ToString()); //deObject.Add("MOD_USER_ID1", OlUser.Manager_LoginName); //deObject.Add("MOD_DATETIME1", DateTime.Now.ToString()); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// GRID3(商品)检索的判断条件 /// </summary> /// <returns></returns> private List <ConditionFun.SqlqueryCondition> InquiryConditionProduct() { string _SHOP_ID = ddlSHOP_NAME.SelectedValue; var modelShop = new SHOP00(x => x.SHOP_ID == _SHOP_ID); List <ConditionFun.SqlqueryCondition> conditionProdduct00List = new List <ConditionFun.SqlqueryCondition>(); //取价格区域 conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, V_Product01_PRCAREATable.PRCAREA_ID, Comparison.Equals, modelShop.SHOP_Price_Area, false, false)); FineUI.TextBox cPROD_ID = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_ID") as FineUI.TextBox; var _PROD_ID = cPROD_ID.Text; if (!String.IsNullOrEmpty(cPROD_ID.Text)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_ID, Comparison.Like, "%" + _PROD_ID + "%", false, false)); } FineUI.TextBox cPROD_NAME = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_NAME") as FineUI.TextBox; var _PROD_NAME = cPROD_NAME.Text; if (!String.IsNullOrEmpty(_PROD_NAME)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_NAME1, Comparison.Like, "%" + _PROD_NAME + "%", false, false)); } FineUI.TextBox cPROD_NAME_SPELLING = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_NAME_SPELLING") as FineUI.TextBox; var _PROD_NAME_SPELLING = cPROD_NAME_SPELLING.Text; if (!String.IsNullOrEmpty(_PROD_NAME_SPELLING)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_NAME1_SPELLING, Comparison.Like, "%" + _PROD_NAME_SPELLING + "%", false, false)); } FineUI.DropDownList cPROD_KIND = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_KIND") as FineUI.DropDownList; var _cPROD_KIND = cPROD_KIND.SelectedValue; if (!String.IsNullOrEmpty(_cPROD_KIND) && _cPROD_KIND != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_KIND, Comparison.Equals, _cPROD_KIND, false, false)); } FineUI.DropDownList cPROD_DEP = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_DEP") as FineUI.DropDownList; var _PROD_DEP = cPROD_DEP.SelectedValue; if (!String.IsNullOrEmpty(_PROD_NAME) && _PROD_DEP != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_DEP, Comparison.Equals, _PROD_DEP, false, false)); } FineUI.DropDownList cPROD_CATE = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_CATE") as FineUI.DropDownList; var _PROD_CATE = cPROD_CATE.SelectedValue; if (!String.IsNullOrEmpty(_PROD_CATE) && _PROD_CATE != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Product01_PRCAREATable.PROD_CATE, Comparison.Equals, _PROD_CATE, false, false)); } return(conditionProdduct00List); }
/// <summary> /// 添加商品,采购单位未完成,价格取值未完成,税额未完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _tbxPREPAR_ID = tbxPREPAR_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_tbxPREPAR_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("PREPARE_ID01", _tbxPREPAR_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", 0); deObject.Add("STD_CONVERT01", 0); deObject.Add("STD_QUAN01", 0); deObject.Add("STD_PRICE01", 0); deObject.Add("COST01", ""); deObject.Add("sProd_ID01", ""); deObject.Add("BAT_NO01", ""); deObject.Add("IsScales01", 0); deObject.Add("IsFlag01", 0); deObject.Add("Scales_User01", ""); deObject.Add("Scale_Date01", DateTime.Now.ToString()); deObject.Add("MEMO01", ""); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
protected void Grid1_RowSelect(object sender, FineUI.GridRowSelectEventArgs e) { string str = GridViewHelper.GetSelectedKey(Grid1, true); string[] col_id_shop_id = str.Split(','); string shop_id = col_id_shop_id[1]; string col_id = col_id_shop_id[0]; DataTable dt_left = null; dt_left = Col_Order00Bll.GetInstence().GET_ARCHIVEORDERS_LEFT_LIST(col_id); Grid2.DataSource = dt_left; Grid2.DataBind(); Grid2.SelectedRowIndex = 0; string prod_id = GridViewHelper.GetSelectedKey(Grid2, true); DataTable dt_right = null; dt_right = Col_Order00Bll.GetInstence().GET_ARCHIVEORDERS_RIGHT_LIST(prod_id, col_id); Grid3.DataSource = dt_right; Grid3.DataBind(); var PurchasePLANColumn0 = Grid3.FindColumn("SUP_QUAN0") as FineUI.RenderField; // HeaderText="生产量/采购量" var PurchasePLANColumn1 = Grid3.FindColumn("SUP_QUAN1") as FineUI.RenderField; // HeaderText="生产量/采购量" var model_ARCHIVEORDERS = new Col_Order00(x => x.COL_ID == col_id); var model_SHOP = new SHOP00(x => x.SHOP_ID == shop_id); string area_id = model_SHOP.SHOP_Area_ID.ToString(); // var model_SYS_PARAMATERS = new SYS_PARAMATERS(x => x.Area_Id == area_id); //根据参数表 显示信息 //if (model_SYS_PARAMATERS != null) //{ //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 0) //产品类型汇整 // { //if (model_ARCHIVEORDERS.PROD_TYPE == 0) { PurchasePLANColumn1.Hidden = true; PPhidId.Text = "0"; } //if (model_ARCHIVEORDERS.PROD_TYPE == 1) { PurchasePLANColumn0.Hidden = true; PPhidId.Text = "1"; } //if (model_ARCHIVEORDERS.PROD_TYPE == 2) { PurchasePLANColumn0.Hidden = true; PPhidId.Text = "1"; } // } //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 1) //产品类型汇整 //{ // if (model_ARCHIVEORDERS.PROD_TYPE == 1) { PurchasePLANColumn0.Hidden = true; PPhidId.Text = "0"; } // if (model_ARCHIVEORDERS.PROD_TYPE == 2) { PurchasePLANColumn0.Hidden = true; PPhidId.Text = "1"; } //} // } }
/// <summary> /// 添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _INV_ID = tbxINV_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_INV_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _prod_name = Grid4.DataKeys[i][1].ToString(); string checkresult = ProdAddCheck(_Prod_ID, _prod_name); if (!String.IsNullOrEmpty(checkresult)) { result = result + "\r\n" + checkresult; continue; } string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME101", _Shop_Name); deObject.Add("INV_ID01", _INV_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.SAFE_QUAN); deObject.Add("QUAN01", 0); deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("QUAN_B01", 0); deObject.Add("MEMO01", 0); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 条件 /// </summary> /// <param name="id"></param> /// <returns></returns> private List <ConditionFun.SqlqueryCondition> InquiryCondition() { string _shop_id = ddlSHOP_NAME.SelectedValue; string _Purchase_ID = tbxPurchase_ID.Text; List <ConditionFun.SqlqueryCondition> condiList = new List <ConditionFun.SqlqueryCondition>(); var model = new SHOP00(x => x.SHOP_ID == _shop_id); string _PRCAREA_ID = model.SHOP_Price_Area; //condiList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, V_Purchase01_PRODUCT00Table.SHOP_ID, Comparison.Equals, _shop_id, false, false)); condiList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, V_Purchase01_PRODUCT00Table.Purchase_ID, Comparison.Equals, _Purchase_ID, false, false)); condiList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.And, V_Purchase01_PRODUCT00Table.PRCAREA_ID, Comparison.Equals, _PRCAREA_ID, false, false)); return(condiList); }
/// <summary> /// 列表按键绑定——修改列表控件属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e) { //绑定是否显示状态列 int o = e.RowIndex; GridRow gr = Grid1.Rows[e.RowIndex]; // + 1 string shop_id = ((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][ORDER00Table.SHOP_ID].ToString(); var model = new SHOP00(x => x.SHOP_ID == shop_id); if (model != null) { // ((System.Data.DataRowView)(gr.DataItem)).Row[e.RowIndex] var lbf = gr.FindControl("SHOP_Name1") as FineUI.Label; lbf.Text = model.SHOP_NAME1; } //GridRow gr = Grid1.Rows[e.RowIndex]; // + 1 //if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][MenuInfoTable.IsDisplay].ToString() == "0") //{ // var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField; // lbf.Icon = Icon.BulletCross; // lbf.CommandArgument = "1"; //} //else //{ // var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField; // lbf.Icon = Icon.BulletTick; // lbf.CommandArgument = "0"; //} ////绑定是否菜单列 //if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][MenuInfoTable.IsMenu].ToString() == "0") //{ // var lbf = Grid1.FindColumn("IsMenu") as LinkButtonField; // lbf.Icon = Icon.BulletCross; // lbf.CommandArgument = "1"; //} //else //{ // var lbf = Grid1.FindColumn("IsMenu") as LinkButtonField; // lbf.Icon = Icon.BulletTick; // lbf.CommandArgument = "0"; //} //绑定是否编辑列 //var lbfEdit = Grid1.FindColumn("ButtonEdit") as LinkButtonField; //lbfEdit.Text = "编辑"; //lbfEdit.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonEdit"); }
protected void ButtonOrderAdd_Click(Object sender, EventArgs e) { FineUI.Grid Grid4 = Window4.FindControl("PanelGrid5").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; tbxRELATE_ID.Text = Grid4.DataKeys[0][0].ToString(); foreach (int i in selections) { List <ConditionFun.SqlqueryCondition> order00con = new List <ConditionFun.SqlqueryCondition>(); order00con.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, OUT_BACK01Table.BK_ID, Comparison.Equals, Grid4.DataKeys[i][0].ToString(), false, false)); List <string> colList = new List <string>(); colList.Add("SHOP_ID"); colList.Add("PROD_ID"); colList.Add("QUANTITY"); colList.Add("STD_UNIT"); colList.Add("STD_CONVERT"); colList.Add("STD_QUAN"); colList.Add("STD_PRICE"); //colList.Add("COST_PRICE"); //colList.Add("");预留采购单位类别 DataTable da = OUT_BACK01Bll.GetInstence().GetDataTable(false, 0, colList, 0, 0, order00con, null); foreach (DataRow dr in da.Rows) { string _shopid = dr["SHOP_ID"].ToString(); string _PROD_ID = dr["PROD_ID"].ToString(); var model = new SHOP00(x => x.SHOP_ID == _shopid); var model2 = new PRODUCT00(x => x.PROD_ID == _PROD_ID); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", dr["SHOP_ID"].ToString()); deObject.Add("SHOP_NAME01", model.SHOP_NAME1); deObject.Add("IB_ID01", tbxIB_ID.Text); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", dr["PROD_ID"].ToString()); deObject.Add("PROD_NAME01", model2.PROD_NAME1); deObject.Add("QUANTITY01", dr["QUANTITY"].ToString()); deObject.Add("STD_TYPE01", dr["STD_UNIT"].ToString()); deObject.Add("STD_UNIT01", dr["STD_UNIT"].ToString()); deObject.Add("STD_CONVERT01", dr["STD_CONVERT"].ToString()); deObject.Add("STD_QUAN01", dr["STD_QUAN"].ToString()); deObject.Add("STD_PRICE01", dr["STD_PRICE"].ToString()); deObject.Add("COST01", dr["STD_PRICE"].ToString()); deObject.Add("QUAN101", dr["STD_QUAN"].ToString()); deObject.Add("QUAN201", dr["STD_QUAN"].ToString()); deObject.Add("MEMO01", ""); deObject.Add("BAT_NO", ""); Grid2.AddNewRecord(deObject, true); } } }
/// <summary> /// 加载采购订单界面 /// </summary> /// <param name="id"></param> public void LoadPur() { int id = ConvertHelper.Cint(hidId.Text); if (id == 0) { FineUI.Alert.ShowInParent("请重新选择采购单", FineUI.MessageBoxIcon.Error); } var model = Purchase00Bll.GetInstence().GetModel(id, false); if (model != null) { tbxPurchase_ID.Text = model.Purchase_ID; hidPurchase_ID.Text = model.Purchase_ID; string _shop_id = model.SHOP_ID; var shopModel = new SHOP00(x => x.SHOP_ID == model.SHOP_ID); //tbxSHOP_ID.Text = model.SHOP_ID; //tbxSHOP_NAME1.Text = shopModel.SHOP_NAME1; ddlSHOP_NAME.SelectedValue = shopModel.SHOP_ID; ddlStatus.SelectedValue = model.STATUS.ToString(); dpINPUT_DATE.Text = model.INPUT_DATE.ToString("yyyy-MM-dd"); dpEXPECT_DATE.Text = model.EXPECT_DATE.ToString("yyyy-MM-dd"); ddlSUP_NAME.SelectedValue = model.SUP_ID.ToString(); ddlPAY_STATUS.SelectedValue = model.PAY_STATUS.ToString(); tbxUSER_ID.Text = model.USER_ID; tbxAPP_USER.Text = model.APP_USER; dpAPP_DATETIME.Text = model.APP_DATETIME.ToString("yyyy-MM-dd"); numTOT_AMOUNT.Text = model.TOT_AMOUNT.ToString(); numTOT_TAX.Text = model.TOT_TAX.ToString(); numTOT_QTY.Text = model.TOT_QTY.ToString(); numPRE_PAY.Text = model.PRE_PAY.ToString(); tbxPRE_PAY_ID.Text = model.PRE_PAY_ID.ToString(); ddlEXPORTED.SelectedValue = model.EXPORTED.ToString(); tbxEXPORTED_ID.Text = model.EXPORTED_ID.ToString(); if (model.LOCKED == 1) { chxLOCKED.Checked = true; } else { chxLOCKED.Checked = false; } tbxCRT_DATETIME.Text = model.CRT_DATETIME.ToString("yyyy-MM-dd"); tbxCRT_USER_ID.Text = model.CRT_USER_ID; tbxMOD_DATETIME.Text = model.MOD_DATETIME.ToString("yyyy-MM-dd"); tbxMOD_USER_ID.Text = model.MOD_USER_ID; tbxLAST_UPDATE.Text = model.LAST_UPDATE.ToString("yyyy-MM-dd"); Purchase00Status(model.STATUS); LockStatus(model.LOCKED); } }
/// <summary> /// 添加可选分店清单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MoveToLeft(object sender, EventArgs e) { //string[] a=Grid5.SelectedRowID; string[] id = GridViewHelper.GetSelectedKey(Grid5, true).Split(','); int _id = ConvertHelper.Cint(id[0]); var model = new SHOP00(x => x.Id == _id); string ordder_id = hidORDDEP_ID.Text; string result = SaveOrderDep01(model.SHOP_ID, ordder_id); if (!String.IsNullOrEmpty(result)) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } LoadOrderDep01(ordder_id); }
/// <summary> /// 判断指定主键Id的记录是否存在——在IIS缓存或数据库中查找 /// </summary> /// <param name="id">主键Id</param> /// <returns></returns> public bool Exist(int id) { if (id <= 0) { return(false); } //判断是否启用缓存 if (CommonBll.IsUseCache()) { return(Exist(x => x.Id == id)); } //从数据库中查找 return(SHOP00.Exists(x => x.Id == id)); }
/// <summary> /// 列表按键绑定——修改列表控件属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid2_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e) { //绑定是否显示状态列 int o = e.RowIndex; DataRowView row = e.DataItem as DataRowView; string shop_id = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][ORDER00Table.SHOP_ID].ToString(); var model = new SHOP00(x => x.SHOP_ID == shop_id); if (model != null) { // ((System.Data.DataRowView)(gr.DataItem)).Row[e.RowIndex] var tf = Grid2.FindColumn("SHOP_LINK") as FineUI.LinkButtonField; tf.Text = model.SHOP_NAME1; } }
/// <summary> /// 获取数据表中的某个值——从数据库中查询,如果使用了缓存,删除成功后会清空本表的所有缓存记录,然后重新加载进缓存 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="expression">条件语句</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Delete(Page page, Expression <Func <SHOP00, bool> > expression, bool isAddUseLog = true) { //执行删除 SHOP00.Delete(expression); //判断是否启用缓存 if (CommonBll.IsUseCache()) { //清空当前表所有缓存记录 DelAllCache(); //重新载入缓存 GetList(); } if (isAddUseLog) { //添加用户操作记录 UseLogBll.GetInstence().Save(page, "{0}删除了SHOP00表记录!"); } }
public override void Init() { var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); //获取用户所属shop shopId = OlUser.SHOP_ID; var shop = new SHOP00(x => x.SHOP_ID == shopId); shopKind = (ShopKind)shop.SHOP_KIND; switch (shopKind) { case ShopKind.Area: InitArea(); break; case ShopKind.DirectStore: case ShopKind.Franchisee: InitShop(); break; } }
/// <summary> /// 数据保存 /// </summary> /// <returns></returns> public override string Save() { string result = string.Empty; int id = ConvertHelper.Cint0(hidId.Text); try { #region 数据验证 if (string.IsNullOrEmpty(txtSHOP_NAME1.Text.Trim())) { return(txtSHOP_NAME1.Label + "不能为空!"); } if (ddlSHOP_Price_Area.SelectedText.Trim() == "请选择价格区域") { ddlSHOP_Price_Area.Label = "价格区域不能为空"; } //var sName = StringHelper.Left(txtName.Text, 50); //if (BranchBll.GetInstence().Exist(x => x.Name == sName && x.Id != id)) //{ // return txtName.Label + "已存在!请重新输入!"; //} //if (string.IsNullOrEmpty(txtId.Text.Trim())) //{ // return txtId.Label + "不能为空!"; //} //var sUrl = StringHelper.Left(txtUrl.Text, 400); //if (BranchBll.GetInstence().Exist(x => x.Url == sUrl && x.Id != id)) //{ // return txtUrl.Label + "已存在!请重新输入!"; //} #endregion #region 赋值 //读取资料 var model = new SHOP00(x => x.Id == id); model.SHOP_ID = txtSHOP_ID.Text; model.SHOP_NAME1 = txtSHOP_NAME1.Text; model.SHOP_NAME2 = txtSHOP_NAME2.Text; model.SHOP_KIND = ConvertHelper.Cint0(txtSHOP_KIND.Text.ToString()); model.SHOP_Area_ID = txtSHOP_Area_ID.SelectedValue.ToString(); model.SHOP_Price_Area = ddlSHOP_Price_Area.SelectedValue.ToString(); model.SHOP_ADD = txtSHOP_ADD.Text; model.SHOP_TEL = txtSHOP_TEL.Text; model.SHOP_EMAIL = txtSHOP_EMAIL.Text; model.SHOP_CONTECT = txtSHOP_CONTECT.Text; model.SHOP_MEMO = txtSHOP_MEMO.Text; model.SHOP_STATUS = ConvertHelper.StringToByte(txtSHOP_STATUS.Text); model.SHOP_Limited = ConvertHelper.Cint0(txtSHOP_Limited.Text); model.CRT_DATETIME = ConvertHelper.StringToDatetime(txtCRT_DATETIME.Text); model.CRT_USER_ID = txtCRT_USER_ID.Text; model.CRT_DATETIME = ConvertHelper.StringToDatetime(txtCRT_DATETIME.Text); model.MOD_USER_ID = txtMOD_USER_ID.Text; model.MOD_DATETIME = ConvertHelper.StringToDatetime(txtMOD_DATETIME.Text); model.LAST_UPDATE = ConvertHelper.StringToDatetime(txtLAST_UPDATE.Text); model.STATUS = ConvertHelper.StringToByte(txtSTATUS.Text); #endregion //---------------------------------------------------------- //存储到数据库 SHOP00Bll.GetInstence().Save(this, model); } catch (Exception e) { result = "保存失败!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } return(result); }
/// <summary> /// 数据保存 /// </summary> /// <returns></returns> public override string Save() { string result = string.Empty; int id = ConvertHelper.Cint0(hidId.Text); try { //判断 if (ddlShop.SelectedValue == "0") { return(ddlShop.Label + "不能为空!"); } if (ddlOUT_SHOP.SelectedValue == "0") { return(ddlOUT_SHOP.Label + "不能为空!"); } if (ddlORDER_DEP.SelectedValue == "0") { return(ddlORDER_DEP.Label + "不能为空!"); } //订单编号 if (txtORDER_ID.Text == "") { Random ran = new Random(); txtORDER_ID.Text = ddlShop.SelectedValue + "OR" + DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "") + ran.Next(1000, 9999); } string manager_LoginName = OnlineUsersBll.GetInstence().GetUserOnlineInfo("Manager_LoginName").ToString();//登录名 txtAPP_USER.Text = manager_LoginName; txtAPP_DATE.SelectedDate = DateTime.Now; string ORDER_ID = txtORDER_ID.Text; // GridViewHelper.GetSelectedKey(Grid2, true); //获取价格区域 string shop_id = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString(); var model_SHOP = new SHOP00(x => x.SHOP_ID == shop_id); string prcarea_id = model_SHOP.SHOP_Price_Area; // 复制原始表格的结构 DataTable newTable = GetSourceData(ORDER_ID, prcarea_id).Clone(); DataRow newRow; JArray mergedData = Grid1.GetMergedData(); int i = 0; foreach (JObject mergedRow in mergedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); i = i + 1; newRow = newTable.NewRow(); newRow[0] = rowIndex;//i;////j;// rowIndex; // 将行标识符设置为行索引号 newRow[1] = values.Value <string>("PROD_NAME1"); newRow[2] = values.Value <string>("PROD_ID"); newRow[3] = values.Value <string>("PROD_SPEC"); newRow[4] = values.Value <string>("PROD_UNIT"); newRow[5] = values.Value <string>("ON_QUAN"); newRow[6] = values.Value <string>("STD_PRICE"); newRow[7] = values.Value <string>("QUAN1"); newTable.Rows.Add(newRow); } // 更新数据源 Session[KEY_FOR_DATASOURCE_SESSION] = newTable; labResult.Text = ""; // String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented)); // MessageBox.Show(this,String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented))); // DataTable table = GetSourceData(); Grid1.DataSource = (DataTable)Session[KEY_FOR_DATASOURCE_SESSION];// table; Grid1.DataBind(); #region 数据验证 //判断列表 DataTable dt = (DataTable)Session[KEY_FOR_DATASOURCE_SESSION]; if (dt.Rows.Count <= 0 || Session[KEY_FOR_DATASOURCE_SESSION] == null) { return("要货明细不能为空!"); } #endregion //改变界面 ddlStatus.SelectedValue = "1" + ""; #region 赋值 主表 var model = new ORDER00(x => x.ORDER_ID == ORDER_ID); model.SHOP_ID = ddlShop.SelectedValue; model.ORDER_ID = txtORDER_ID.Text; model.INPUT_DATE = DateTime.Now; // ConvertHelper.StringToDatetime(txtINPUT_DATE.Text); model.ORD_USER = txtORD_USER.Text; model.EXPECT_DATE = DateTime.Now; // ConvertHelper.StringToDatetime(txtEXPECT_DATE.Text); model.STATUS = 1; model.ORD_TYPE = ConvertHelper.Cint0(ddlORD_TYPE.SelectedValue); model.OUT_SHOP = ddlOUT_SHOP.SelectedValue; model.EXPORTED_ID = txtEXPORTED_ID.Text; model.EXPORTED = ConvertHelper.StringToByte(txtEXPORTED.Text); model.APP_USER = txtAPP_USER.Text; model.APP_DATE = DateTime.Now;//ConvertHelper.StringToDatetime(txtAPP_DATE.Text); model.Memo = txtMemo.Text; model.LOCKED = ConvertHelper.StringToByte(cbLOCKED.Checked.ToString()); model.ORD_DEP_ID = ddlORDER_DEP.SelectedValue; model.CRT_DATETIME = DateTime.Now; //ConvertHelper.StringToDatetime(txtCRT_DATETIME.Text); model.CRT_USER_ID = txtCRT_USER_ID.Text; model.MOD_DATETIME = DateTime.Now; //ConvertHelper.StringToDatetime(txtMOD_DATETIME.Text); model.MOD_USER_ID = txtMOD_USER_ID.Text; model.LAST_UPDATE = DateTime.Now; //ConvertHelper.StringToDatetime(txtLAST_UPDATE.Text); model.Trans_STATUS = 0; #endregion //---------------------------------------------------------- //存储到数据库 ORDER00Bll.GetInstence().Save(this, model); //清空子表 ORDER00Bll.GetInstence().Delete(model.ORDER_ID); #region 添加子表 JArray mergedData1 = Grid1.GetMergedData(); int f = mergedData.Count; int k = 0; foreach (JObject mergedRow in mergedData1) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); k = k + 1; var model_1 = new ORDER01(x => x.SNo == k && x.ORDER_ID == txtORDER_ID.Text.Trim()); model_1.SNo = k;// rowIndex + 1; model_1.SHOP_ID = ddlShop.SelectedValue; model_1.ORDER_ID = txtORDER_ID.Text.Trim(); model_1.PROD_ID = values.Value <string>("PROD_ID"); model_1.QUANTITY = 0; model_1.ON_QUAN = ConvertHelper.StringToDecimal(values.Value <string>("ON_QUAN")); model_1.QUAN1 = ConvertHelper.StringToDecimal(values.Value <string>("QUAN1"));//小计 model_1.QUAN2 = 0; model_1.COST_PRICE = ConvertHelper.StringToDecimal(values.Value <string>("STD_PRICE")); model_1.STD_UNIT = values.Value <string>("PROD_UNIT"); model_1.STD_CONVERT = 0; model_1.STD_QUAN = ConvertHelper.StringToDecimal(values.Value <string>("ON_QUAN")); model_1.STD_PRICE = ConvertHelper.StringToDecimal(values.Value <string>("STD_PRICE")); model_1.Memo = ""; model_1.CRT_DATETIME = DateTime.Now; model_1.CRT_USER_ID = txtCRT_USER_ID.Text; model_1.MOD_DATETIME = DateTime.Now; model_1.MOD_USER_ID = txtMOD_USER_ID.Text; //---------------------------------------------------------- //存储到数据库 ORDER01Bll.GetInstence().Save(this, model_1); } ///grid2 conditionList = new List <ConditionFun.SqlqueryCondition>(); conditionList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, ORDER00Table.SHOP_ID, Comparison.Equals, shop_id, false, false)); // ORDER00Bll.GetInstence().BindGrid(Grid2, 0, sortList); // bll.BindGrid(Grid2, 0, sortList); ORDER00Bll.GetInstence().BindGrid(Grid2, 0, 0, conditionList, sortList); #endregion } catch (Exception e) { result = "保存失败!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } return(result); }
/// <summary> /// GRID3检索的判断条件 /// </summary> /// <returns></returns> private List <ConditionFun.SqlqueryCondition> InquiryConditionProduct() { string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new SHOP00(x => x.SHOP_ID == _shop_id); List <ConditionFun.SqlqueryCondition> conditionProdduct00List = new List <ConditionFun.SqlqueryCondition>(); bool sFlag = true; string _SUP_ID = ddlSUP_NAME.SelectedValue; conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Or, V_Product01_PRCAREATable.PROD_TYPE, Comparison.In, new string[2] { "1", "2" }, true, true)); if (!String.IsNullOrEmpty(_SUP_ID)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.SUP_ID, Comparison.Like, _SUP_ID, true, false)); sFlag = false; } if (!String.IsNullOrEmpty(model.SHOP_Price_Area)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PRCAREA_ID, Comparison.Equals, model.SHOP_Price_Area, true, true)); sFlag = false; } //conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, "1", Comparison.Equals, "1", false, false)); FineUI.TextBox cPROD_ID = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_ID") as FineUI.TextBox; var _PROD_ID = cPROD_ID.Text; if (!String.IsNullOrEmpty(cPROD_ID.Text)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_ID, Comparison.Like, "%" + _PROD_ID + "%", true, true)); sFlag = false; } FineUI.TextBox cPROD_NAME = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_NAME") as FineUI.TextBox; var _PROD_NAME = cPROD_NAME.Text; if (!String.IsNullOrEmpty(_PROD_NAME)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_NAME1, Comparison.Like, "%" + _PROD_NAME + "%", true, true)); sFlag = false; } FineUI.TextBox cPROD_NAME_SPELLING = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_NAME_SPELLING") as FineUI.TextBox; var _PROD_NAME_SPELLING = cPROD_NAME_SPELLING.Text; if (!String.IsNullOrEmpty(_PROD_NAME_SPELLING)) { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_NAME1_SPELLING, Comparison.Like, "%" + _PROD_NAME_SPELLING + "%", true, true)); sFlag = false; } FineUI.DropDownList cPROD_KIND = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_KIND") as FineUI.DropDownList; var _cPROD_KIND = cPROD_KIND.SelectedValue; if (!String.IsNullOrEmpty(_cPROD_KIND) && _cPROD_KIND != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_KIND, Comparison.Equals, _cPROD_KIND, true, true)); sFlag = false; } FineUI.DropDownList cPROD_DEP = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_DEP") as FineUI.DropDownList; var _PROD_DEP = cPROD_DEP.SelectedValue; if (!String.IsNullOrEmpty(_PROD_NAME) && _PROD_DEP != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_DEP, Comparison.Equals, _PROD_DEP, true, true)); sFlag = false; } FineUI.DropDownList cPROD_CATE = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("ccPROD_CATE") as FineUI.DropDownList; var _PROD_CATE = cPROD_CATE.SelectedValue; if (!String.IsNullOrEmpty(_PROD_CATE) && _PROD_CATE != "0") { conditionProdduct00List.Add(new ConditionFun.SqlqueryCondition(WhereOrAnd(sFlag), V_Product01_PRCAREATable.PROD_CATE, Comparison.Equals, _PROD_CATE, true, true)); sFlag = false; } return(conditionProdduct00List); }
/// <summary> /// 添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _Pur00_ID = hidPurchase_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; int rowCount = Grid2.Rows.Count; if (!String.IsNullOrEmpty(_Pur00_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _prod_name = Grid4.DataKeys[i][1].ToString(); string checkresult = ProdAddCheck(_Prod_ID, _prod_name); if (!String.IsNullOrEmpty(checkresult)) { result = result + "\r\n" + checkresult; continue; } string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("Purchase_ID01", _Pur00_ID); rowCount = rowCount + 1; deObject.Add("SNo01", rowCount); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("PROD_NAME02", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", model.Purchase_UNIT); deObject.Add("STD_UNIT_NAME01", model.Purchase_UNIT_NAME); deObject.Add("STD_CONVERT01", model.Purchase_CONVERT); deObject.Add("STD_QUAN01", model.Purchase_QUAN); deObject.Add("STD_PRICE01", model.Purchase_PRICE); if (model.TAX_TYPE == '0') { deObject.Add("Tax01", 0); } else { deObject.Add("Tax01", ConvertHelper.Cdbl((model.Purchase_PRICE.ToString())) * ConvertHelper.Cdbl((model.Purchase_QUAN.ToString())) * ConvertHelper.Cdbl((model.Tax.ToString())) * 0.01); } deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("Item_DISC_Amt01", 0); deObject.Add("MEMO", ""); deObject.Add("UNIT_NAME01", model.UNIT_NAME); deObject.Add("UNIT_NAME101", model.UNIT_NAME1); deObject.Add("UNIT_NAME201", model.UNIT_NAME2); deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1); deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2); deObject.Add("SUP_COST01", model.SUP_COST); deObject.Add("SUP_COST101", model.SUP_COST1); deObject.Add("SUP_COST201", model.SUP_COST2); deObject.Add("Tax_Num01", model.Tax); deObject.Add("Tax_Type01", model.TAX_TYPE); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.SHOP00</returns> public DataAccess.Model.SHOP00 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.SHOP00 model = null; Expression <Func <SHOP00, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "SHOP_NAME1": model = list.SingleOrDefault(x => x.SHOP_NAME1 == (string)value); expression = x => x.SHOP_NAME1 == (string)value; break; case "SHOP_NAME2": model = list.SingleOrDefault(x => x.SHOP_NAME2 == (string)value); expression = x => x.SHOP_NAME2 == (string)value; break; case "SHOP_KIND": model = list.SingleOrDefault(x => x.SHOP_KIND == (int)value); expression = x => x.SHOP_KIND == (int)value; break; case "SHOP_Area_ID": model = list.SingleOrDefault(x => x.SHOP_Area_ID == (int)value); expression = x => x.SHOP_Area_ID == (int)value; break; case "SHOP_Price_Area": model = list.SingleOrDefault(x => x.SHOP_Price_Area == (string)value); expression = x => x.SHOP_Price_Area == (string)value; break; case "SHOP_ADD": model = list.SingleOrDefault(x => x.SHOP_ADD == (string)value); expression = x => x.SHOP_ADD == (string)value; break; case "SHOP_TEL": model = list.SingleOrDefault(x => x.SHOP_TEL == (string)value); expression = x => x.SHOP_TEL == (string)value; break; case "SHOP_EMAIL": model = list.SingleOrDefault(x => x.SHOP_EMAIL == (string)value); expression = x => x.SHOP_EMAIL == (string)value; break; case "SHOP_CONTECT": model = list.SingleOrDefault(x => x.SHOP_CONTECT == (string)value); expression = x => x.SHOP_CONTECT == (string)value; break; case "SHOP_MEMO": model = list.SingleOrDefault(x => x.SHOP_MEMO == (string)value); expression = x => x.SHOP_MEMO == (string)value; break; case "SHOP_STATUS": model = list.SingleOrDefault(x => x.SHOP_STATUS == (byte)value); expression = x => x.SHOP_STATUS == (byte)value; break; case "SHOP_Limited": model = list.SingleOrDefault(x => x.SHOP_Limited == (int)value); expression = x => x.SHOP_Limited == (int)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (byte)value); expression = x => x.STATUS == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = SHOP00.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取SHOP00表记录时出现异常", e); return(null); } }
/// <summary> /// 添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _OUT_ID = tbxOUT_ID.Text; string _Shop_ID = ddlIN_SHOP.SelectedValue; string _Shop_Name = ddlIN_SHOP.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; int rowCount = Grid2.Rows.Count; if (!String.IsNullOrEmpty(_OUT_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _shop_id = ddlSHOP_NAME.SelectedValue; string _prod_name = Grid4.DataKeys[i][1].ToString(); string checkresult = ProdAddCheck(_Prod_ID, _prod_name); if (!String.IsNullOrEmpty(checkresult)) { result = result + "\r\n" + checkresult; continue; } var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME101", _Shop_Name); deObject.Add("OUT_ID01", _OUT_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", model.ORDER_UNIT); string STD_PRICE01 = ""; string PROD_CONVERT = ""; //根据门店类型取进价 if (m_Shop.SHOP_KIND == 2) { switch (model.ORDER_UNIT) { case 1: STD_PRICE01 = model.T_COST.ToString(); PROD_CONVERT = "1"; break; case 2: STD_PRICE01 = model.T_COST1.ToString(); PROD_CONVERT = model.PROD_CONVERT1.ToString(); break; case 3: STD_PRICE01 = model.T_COST2.ToString(); PROD_CONVERT = model.PROD_CONVERT2.ToString(); break; default: STD_PRICE01 = model.T_COST.ToString(); PROD_CONVERT = "1";; break; } deObject.Add("STD_PRICE101", model.T_COST); deObject.Add("STD_PRICE201", model.T_COST1); deObject.Add("STD_PRICE301", model.T_COST2); } else { switch (model.ORDER_UNIT) { case 1: STD_PRICE01 = model.U_Cost.ToString(); PROD_CONVERT = "1"; break; case 2: STD_PRICE01 = model.U_Cost1.ToString(); PROD_CONVERT = model.PROD_CONVERT1.ToString(); break; case 3: STD_PRICE01 = model.U_Cost2.ToString(); PROD_CONVERT = model.PROD_CONVERT1.ToString(); break; default: STD_PRICE01 = model.U_Cost.ToString(); PROD_CONVERT = "1"; break; } deObject.Add("STD_PRICE101", model.U_Cost); deObject.Add("STD_PRICE201", model.U_Cost1); deObject.Add("STD_PRICE301", model.U_Cost2); } deObject.Add("STD_CONVERT01", PROD_CONVERT); deObject.Add("STD_UNIT_NAME01", model.ORDER_NAME); deObject.Add("STD_QUAN01", model.ORDER_UNIT); deObject.Add("STD_PRICE01", STD_PRICE01); deObject.Add("MIN_STD_QUAN01", model.ORDER_UNIT); deObject.Add("COST01", model.COST); deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("MEMO01", ""); deObject.Add("BAT_NO", ""); deObject.Add("UNIT_NAME01", model.UNIT_NAME); deObject.Add("UNIT_NAME101", model.UNIT_NAME1); deObject.Add("UNIT_NAME201", model.UNIT_NAME2); deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1); deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2); deObject.Add("COST101", model.COST); deObject.Add("COST201", model.COST1); deObject.Add("COST301", model.COST2); rowCount = rowCount + 1; Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 更新IIS缓存中指定Id记录 /// </summary> /// <param name="model">记录实体</param> public void SetModelForCache(SHOP00 model) { SetModelForCache(Transform(model)); }
/// <summary> /// 列表按键绑定——修改列表控件属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e) { //绑定是否显示状态列 int o = e.RowIndex; DataRowView row = e.DataItem as DataRowView; string shop_id = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.SHOP_ID].ToString(); var model = new SHOP00(x => x.SHOP_ID == shop_id); if (model != null) { // ((System.Data.DataRowView)(gr.DataItem)).Row[e.RowIndex] var tf = Grid1.FindColumn("SHOP_LIK") as FineUI.LinkButtonField; tf.Text = model.SHOP_NAME1; } string col_id = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.COL_ID].ToString(); var model_ARCHIVEORDERS = new Col_Order00(x => x.COL_ID == col_id); var model_SHOP = new SHOP00(x => x.SHOP_ID == shop_id); string area_id = model_SHOP.SHOP_Area_ID.ToString(); var model_SYS_PARAMATERS = new SYS_PARAMATERS(x => x.Area_Id == area_id); string type = ""; if (model_SYS_PARAMATERS != null) { var a_type = Grid1.FindColumn("ARCHIVEORDERS_TYPE") as FineUI.LinkButtonField; //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 0) //产品类型汇整 //{ if (model_ARCHIVEORDERS.PROD_TYPE == 0) { type = "自产型"; } if (model_ARCHIVEORDERS.PROD_TYPE == 1) { type = "供应型"; } if (model_ARCHIVEORDERS.PROD_TYPE == 2) { type = "委托加工型"; } //} //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 1) //产品类型汇整 //{ // if (model_ARCHIVEORDERS.PROD_TYPE == 1) { type = "普通订货"; } // if (model_ARCHIVEORDERS.PROD_TYPE == 2) { type = "客户订货"; } //} a_type.Text = type; //1=存档 2=已核准 3=作废 4=已汇整 [缺省值=0] string status = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.STATUS].ToString(); var astatus = Grid1.FindColumn("ARCHIVEORDERS_STATUS") as FineUI.LinkButtonField; if (status == "1") { astatus.Text = "存档"; } if (status == "2") { astatus.Text = "已核准"; } if (status == "3") { astatus.Text = "作废"; } if (status == "4") { astatus.Text = "已汇整"; } } //GridRow gr = Grid1.Rows[e.RowIndex]; // + 1 //if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][MenuInfoTable.IsDisplay].ToString() == "0") //{ // var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField; // lbf.Icon = Icon.BulletCross; // lbf.CommandArgument = "1"; //} //else //{ // var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField; // lbf.Icon = Icon.BulletTick; // lbf.CommandArgument = "0"; //} ////绑定是否菜单列 //if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][MenuInfoTable.IsMenu].ToString() == "0") //{ // var lbf = Grid1.FindColumn("IsMenu") as LinkButtonField; // lbf.Icon = Icon.BulletCross; // lbf.CommandArgument = "1"; //} //else //{ // var lbf = Grid1.FindColumn("IsMenu") as LinkButtonField; // lbf.Icon = Icon.BulletTick; // lbf.CommandArgument = "0"; //} //绑定是否编辑列 //var lbfEdit = Grid1.FindColumn("ButtonEdit") as LinkButtonField; //lbfEdit.Text = "编辑"; //lbfEdit.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonEdit"); }
/// <summary> /// 从IIS缓存中获取SHOP00表记录 /// </summary> /// <param name="isCache">是否从缓存中读取</param> public IList <DataAccess.Model.SHOP00> GetList(bool isCache = true) { try { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //检查指定缓存是否过期——缓存当天有效,第二天自动清空 if (CommonBll.CheckCacheIsExpired(const_CacheKey_Date)) { //删除缓存 DelAllCache(); } //从缓存中获取DataTable var obj = CacheHelper.GetCache(const_CacheKey); //如果缓存为null,则查询数据库 if (obj == null) { var list = GetList(false); //将查询出来的数据存储到缓存中 CacheHelper.SetCache(const_CacheKey, list); //存储当前时间 CacheHelper.SetCache(const_CacheKey_Date, DateTime.Now); return(list); } //缓存中存在数据,则直接返回 else { return((IList <DataAccess.Model.SHOP00>)obj); } } else { //定义临时实体集 IList <DataAccess.Model.SHOP00> list = null; //获取全表缓存加载条件表达式 var exp = GetExpression <SHOP00>(); //如果条件为空,则查询全表所有记录 if (exp == null) { //从数据库中获取所有记录 var all = SHOP00.All(); list = all == null ? null : Transform(all.ToList()); } else { //从数据库中查询出指定条件的记录,并转换为指定实体集 var all = SHOP00.Find(exp); list = all == null ? null : Transform(all); } return(list); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取SHOP00表记录时出现异常", e); } return(null); }
//protected void ButtonApproval_Click(object sender, EventArgs e) //{ // string str = GridViewHelper.GetSelectedKey(Grid1, true); // string[] col_id_shop_id = str.Split(','); // string shop_id = col_id_shop_id[1]; // string col_id = col_id_shop_id[0]; // string // int ex_int = OUT00Bll.GetInstence().SplitOrders(col_id,); // if (ex_int == 1) // { // Alert.Show("核准失败,请重新核准!"); // } // else // { // Alert.Show("核准成功!"); // } //} #region 列表属性绑定 #region 列表按键绑定——修改列表控件属性 /// <summary> /// 列表按键绑定——修改列表控件属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e) { //绑定是否显示状态列 int o = e.RowIndex; DataRowView row = e.DataItem as DataRowView; string shop_id = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.SHOP_ID].ToString(); var model = new SHOP00(x => x.SHOP_ID == shop_id); if (model != null) { // ((System.Data.DataRowView)(gr.DataItem)).Row[e.RowIndex] var tf = Grid1.FindColumn("SHOP_LIK") as FineUI.LinkButtonField; tf.Text = model.SHOP_NAME1; } string col_id = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.COL_ID].ToString(); var model_ARCHIVEORDERS = new Col_Order00(x => x.COL_ID == col_id); var model_SHOP = new SHOP00(x => x.SHOP_ID == shop_id); string area_id = model_SHOP.SHOP_Area_ID.ToString(); var model_SYS_PARAMATERS = new SYS_PARAMATERS(x => x.Area_Id == area_id); string type = ""; if (model_SYS_PARAMATERS != null) { var a_type = Grid1.FindColumn("ARCHIVEORDERS_TYPE") as FineUI.LinkButtonField; //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 0) //产品类型汇整 //{ // if (model_ARCHIVEORDERS.PROD_TYPE == 0) { type = "自产型"; } // if (model_ARCHIVEORDERS.PROD_TYPE == 1) { type = "供应型"; } // if (model_ARCHIVEORDERS.PROD_TYPE == 2) { type = "委托加工型"; } //} //if (model_SYS_PARAMATERS.COL_ORDER_TYPE == 1) //产品类型汇整 //{ // if (model_ARCHIVEORDERS.PROD_TYPE == 1) { type = "普通订货"; } // if (model_ARCHIVEORDERS.PROD_TYPE == 2) { type = "客户订货"; } //} a_type.Text = type; //1=存档 2=已核准 3=作废 4=已汇整 [缺省值=0] string status = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][Col_Order00Table.STATUS].ToString(); var astatus = Grid1.FindColumn("ARCHIVEORDERS_STATUS") as FineUI.LinkButtonField; if (status == "1") { astatus.Text = "存档"; } if (status == "2") { astatus.Text = "已核准"; } if (status == "3") { astatus.Text = "作废"; } if (status == "4") { astatus.Text = "已汇整"; } } }