protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["StoreId"], out this.SotreId)) { base.GotoResourceNotFound(); return; } this.btnSave.Click += new System.EventHandler(this.btnEditShipper_Click); if (!this.Page.IsPostBack) { StoreManagementInfo store = StoreManagementHelper.GetStore(this.SotreId); if (store == null) { base.GotoResourceNotFound(); return; } Globals.EntityCoding(store, false); this.txtSupplierName.Text = store.StoreName; this.ddlReggion.SetSelectedRegionId(new int?(store.County)); this.txtAddress.Text = store.Address; this.txtPhone.Text = store.Phone; this.txtMobile.Text = store.Mobile; this.txtAddress.Text = store.Address; this.txtDescription.Text = store.Description; } }
public StoreManagementInfo GetStore(int StoreId) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Ecshop_StoreManagement WHERE StoreId = @StoreId"); this.database.AddInParameter(sqlStringCommand, "StoreId", DbType.Int32, StoreId); StoreManagementInfo result = null; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <StoreManagementInfo>(dataReader); } return(result); }
public bool UpdateStore(StoreManagementInfo supplierInfo) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Ecshop_StoreManagement SET StoreName=@StoreName,[Phone]=@Phone,[Mobile]=@Mobile,[County]=@County,[Address]=@Address,[Description]=@Description WHERE StoreId=@StoreId"); this.database.AddInParameter(sqlStringCommand, "StoreName", DbType.String, supplierInfo.StoreName); this.database.AddInParameter(sqlStringCommand, "Phone", DbType.String, supplierInfo.Phone); this.database.AddInParameter(sqlStringCommand, "Mobile", DbType.String, supplierInfo.Mobile); this.database.AddInParameter(sqlStringCommand, "County", DbType.Int32, supplierInfo.County); this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, supplierInfo.Address); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, supplierInfo.Description); this.database.AddInParameter(sqlStringCommand, "StoreId", DbType.Int32, supplierInfo.StoreId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["StoreId"], out this.StoreId)) { base.GotoResourceNotFound(); return; } this.hdtopic.Value = this.StoreId.ToString(); this.btnDeleteAll.Click += new System.EventHandler(this.btnDeleteAll_Click); this.grdTopicProducts.RowDeleting += new System.Web.UI.WebControls.GridViewDeleteEventHandler(this.grdTopicProducts_RowDeleting); if (!this.Page.IsPostBack) { StoreManagementInfo store = StoreManagementHelper.GetStore(this.StoreId); if (store == null) { base.GotoResourceNotFound(); return; } this.litPromotionName.Text = store.StoreName; this.BindStoreProducts(); } }
private void btnSave_Click(object sender, System.EventArgs e) { StoreManagementInfo StoreInfo = new StoreManagementInfo(); StoreInfo.StoreName = this.txtSupplierName.Text.Trim(); if (!this.ddlReggion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择地区", false); return; } StoreInfo.County = this.ddlReggion.GetSelectedRegionId().Value; StoreInfo.Address = this.txtAddress.Text.Trim(); StoreInfo.Phone = this.txtPhone.Text.Trim(); StoreInfo.Mobile = this.txtMobile.Text.Trim(); StoreInfo.Description = this.txtDescription.Text.Trim(); if (string.IsNullOrEmpty(StoreInfo.Phone) && string.IsNullOrEmpty(StoreInfo.Mobile)) { this.ShowMsg("手机号码和电话号码必填其一", false); return; } int issucess = StoreManagementHelper.AddStore(StoreInfo); if (issucess > 0) { this.txtSupplierName.Text = ""; this.txtAddress.Text = ""; this.txtPhone.Text = ""; this.txtMobile.Text = ""; this.txtDescription.Text = ""; this.ShowMsg("添加成功", true); base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/StoreManagement.aspx"), true); return; } this.ShowMsg("添加失败", false); }
public int AddStore(StoreManagementInfo supplierInfo) { int result = 0; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Ecshop_StoreManagement([StoreName],[Phone],[Mobile],[Province],[City],[County],[Address],[Status],[Description],[CreateUser]) VALUES(@StoreName,@Phone,@Mobile,@Province,@City,@County,@Address,@Status,@Description,@CreateUser);SELECT @@IDENTITY"); this.database.AddInParameter(sqlStringCommand, "StoreName", DbType.String, supplierInfo.StoreName); this.database.AddInParameter(sqlStringCommand, "Phone", DbType.String, supplierInfo.Phone); this.database.AddInParameter(sqlStringCommand, "Mobile", DbType.String, supplierInfo.Mobile); this.database.AddInParameter(sqlStringCommand, "Province", DbType.Int32, supplierInfo.Province); this.database.AddInParameter(sqlStringCommand, "City", DbType.Int32, supplierInfo.City); this.database.AddInParameter(sqlStringCommand, "County", DbType.Int32, supplierInfo.County); this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, supplierInfo.Address); this.database.AddInParameter(sqlStringCommand, "Status", DbType.Int32, supplierInfo.Status); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, supplierInfo.Description); this.database.AddInParameter(sqlStringCommand, "CreateUser", DbType.Int32, supplierInfo.CreateUser); object obj = this.database.ExecuteScalar(sqlStringCommand); if (obj != null) { result = Convert.ToInt32(obj.ToString()); } return(result); }
public static int AddStore(StoreManagementInfo supplierInfo) { int result; if (supplierInfo == null) { result = 0; } else { StoreManagementDao SupplierDao = new StoreManagementDao(); Globals.EntityCoding(supplierInfo, true); int num = SupplierDao.AddStore(supplierInfo); if (num > 0) { EventLogs.WriteOperationLog(Privilege.StoreAdd, string.Format(CultureInfo.InvariantCulture, "创建了一个新的门店:”{0}”", new object[] { supplierInfo.StoreName })); } result = num; } return(result); }
public static bool UpdateStore(StoreManagementInfo supplierInfo) { bool result; if (supplierInfo == null) { result = false; } else { StoreManagementDao SupplierDao = new StoreManagementDao(); Globals.EntityCoding(supplierInfo, true); bool flag = SupplierDao.UpdateStore(supplierInfo); if (flag) { EventLogs.WriteOperationLog(Privilege.SupplierEdit, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的门店", new object[] { supplierInfo.StoreId })); } result = flag; } return(result); }