protected void btnSave_Click(object sender, EventArgs e) { StoreLocationType model = new StoreLocationType(); model.TypeName = this.txtTypeName.Text.Trim(); if (this.hidTypeID.Value.Length > 0) { model.TypeID = int.Parse(this.hidTypeID.Value); Service.UpdateStoreLocationType(model); } else { StoreLocationType temp = new StoreLocationType(); temp.TypeName = model.TypeName; if (Service.ExistStoreLocationType(temp)) { RegisterStartupScript("Message", "<script>alert('该区域类型名称已存在');</script>"); } else { model = Service.AddStoreLocationType(model); this.hidTypeID.Value = model.TypeID.ToString(); } } }
protected void btnSave_Click(object sender, EventArgs e) { StoreLocationType model = new StoreLocationType(); model.TypeName = this.txtTypeName.Text.Trim(); model.RequiredToCount = cbRequired.Checked; if (this.hidTypeID.Value.Length > 0) { model.TypeID = int.Parse(this.hidTypeID.Value); Service.UpdateStoreLocationType(model); } else { StoreLocationType temp = new StoreLocationType(); temp.TypeName = model.TypeName; if (Service.ExistStoreLocationType(temp)) { RegisterStartupScript("Message", "<script>alert('该区域类型名称已存在');</script>"); return; } else { model = Service.AddStoreLocationType(model); this.hidTypeID.Value = model.TypeID.ToString(); } } ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "closeDialogOnSave();", true); }
private void bindGridView() { StoreLocationType filter = new StoreLocationType(); List <StoreLocationType> objs = Service.QueryStoreLocationTypes(filter); this.GridView1.DataSource = objs; this.GridView1.DataBind(); }
private void bindBaseData(string typeID) { StoreLocationType model = Service.GetStoreLocationTypeByKey(new StoreLocationType { TypeID = int.Parse(typeID) }); this.hidTypeID.Value = model.TypeID.ToString(); this.txtTypeName.Text = model.TypeName; }
protected void Toolbar1_ButtonClicked(object sender, SCS.Web.UI.WebControls.ButtonEventArgs e) { switch (e.CommandName) { case "Publish": List<StoreLocationType> locationTypes = new List<StoreLocationType>(); for (int i = 0; i < rpSLOC.Items.Count; i++) { CheckBox cbSLOC = rpSLOC.Items[i].FindControl("cbSLOC") as CheckBox; if (cbSLOC.Checked) { string sloc = cbSLOC.Text; StoreLocationType location = this.StoreLocationTypes.Find(s => s.TypeName == sloc); if (location != null) { locationTypes.Add(location); } } } if (locationTypes.Count <= 0) { return; } TextBox txtPlanDate = fvNotification.FindControl("txtPlanDate") as TextBox; DateTime planDate = DateTime.Parse(txtPlanDate.Text); RadioButtonList rblEmergency = fvNotification.FindControl("rblEmergency") as RadioButtonList; bool isEmergent = (rblEmergency.SelectedIndex == 0); Service.PublishNotification(new StocktakeNotification { NotificationID = NotificationID, Publisher = CurrentUser.UserInfo, PlanDate = planDate, IsEmergent = isEmergent }, locationTypes); Toolbar1.Visible = false; //Toolbar1.Items[1].Visible = true; Response.Write("<script>alert('发布成功!');</script>"); Response.Write("<script>window.close();</script>"); //ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "closeDialogOnPublish();", true); break; default: break; } }
public void UpdateUserGroup(UserGroup userGroup) { UserGroup ug = Context.UserGroup.Include("Operations").FirstOrDefault(u => u.GroupID == userGroup.GroupID); ug.GroupName = userGroup.GroupName; ug.AnalyzeAll = userGroup.AnalyzeAll; ug.CurrentDynamicStocktake = userGroup.CurrentDynamicStocktake; ug.CurrentStaticStocktake = userGroup.CurrentStaticStocktake; //ug.DUNS = userGroup.DUNS; ug.FillinAllLocation = userGroup.FillinAllLocation; ug.MaxDynamicStocktake = userGroup.MaxDynamicStocktake; ug.MaxStaticStocktake = userGroup.MaxStaticStocktake; ug.ShowAllLocation = userGroup.ShowAllLocation; ug.SysAdmin = userGroup.SysAdmin; StoreLocationType locationType = null; if (userGroup.StoreLocationType != null) { StoreLocationTypeBLL locationTypeBll = new StoreLocationTypeBLL(Context); locationType = locationTypeBll.GetStoreLocationTypeByKey(userGroup.StoreLocationType); } ug.StoreLocationType = locationType; List <Operation> ops = ug.Operations.ToList(); for (int i = ops.Count - 1; i >= 0; i--) { ug.Operations.Remove(ops[i]); } foreach (var item in userGroup.Operations) { Operation operation = Context.Operation.FirstOrDefault(o => o.OperationID == item.OperationID); ug.Operations.Add(operation); } Context.SaveChanges(); }
protected void rpSLOC_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item) { CheckBox cbSLOC = e.Item.FindControl("cbSLOC") as CheckBox; StoreLocationType type = this.StoreLocationTypes.Find(t => string.Equals(t.TypeName, cbSLOC.Text)); //if (type.RequiredToCount.Value) ////if (Toolbar1.Visible&&cbSLOC.Text=="RDC") //{ // cbSLOC.Checked = true; //} //if (SelectedLocationTypes.IndexOf(cbSLOC.Text) >= 0) //{ // cbSLOC.Checked = true; //} if (type.RequiredToCount.Value || SelectedLocationTypes.IndexOf(cbSLOC.Text) >= 0||(SelectedLocationTypes == null || SelectedLocationTypes.Count == 0) && (type.TypeID == 3 && _existsRepairPart || type.TypeID == 4 && _existsCSMTPart)) { cbSLOC.Checked = true; } StoreLocation location = e.Item.DataItem as StoreLocation; cbSLOC.Enabled = (Mode != PageMode.View); } else { if (e.Item.ItemType == ListItemType.AlternatingItem) { CheckBox cbSLOC = e.Item.FindControl("cbSLOC") as CheckBox; StoreLocationType type = this.StoreLocationTypes.Find(t => string.Equals(t.TypeName, cbSLOC.Text)); if (type.RequiredToCount.Value || SelectedLocationTypes.IndexOf(cbSLOC.Text) >= 0 || (SelectedLocationTypes == null || SelectedLocationTypes.Count == 0) && (type.TypeID == 3 && _existsRepairPart || type.TypeID == 4 && _existsCSMTPart)) //if (SelectedLocationTypes.IndexOf(cbSLOC.Text) >= 0) { cbSLOC.Checked = true; } cbSLOC.Enabled = (Mode != PageMode.View); } } }
protected void btnSave_Click(object sender, EventArgs e) { UserGroup userGroup = new UserGroup(); #region Set the user group values userGroup.GroupName = this.txtGroupName.Text.Trim(); userGroup.ShowAllLocation = this.chkShowAllLocation.Checked; //model.DUNS = this.txtSupplier.Text.Trim(); userGroup.SysAdmin = this.chkSysAdmin.Checked; userGroup.AnalyzeAll = this.chkAnalyzeAll.Checked; userGroup.FillinAllLocation = this.chkFillinAllLocation.Checked; int iTake; if (int.TryParse(this.txtMaxDynamicStocktake.Text.Trim(), out iTake)) { userGroup.MaxDynamicStocktake = iTake; } if (int.TryParse(this.txtMaxStaticStocktake.Text.Trim(), out iTake)) { userGroup.MaxStaticStocktake = iTake; } if (int.TryParse(this.txtCurrentDynamicStocktake.Text.Trim(), out iTake)) { userGroup.CurrentDynamicStocktake = iTake; } if (int.TryParse(this.txtCurrentStaticStocktake.Text.Trim(), out iTake)) { userGroup.CurrentStaticStocktake = iTake; } try { StoreLocationType slType = new StoreLocationType { TypeID = Convert.ToInt32(ddlStoreLocationType.SelectedValue), TypeName = ddlStoreLocationType.SelectedItem.Text }; userGroup.StoreLocationType = slType; //StoreLocation stloc = new StoreLocation(); //stloc.LocationID = Convert.ToInt32(ddlStoreLocationID.SelectedValue); //stloc.LocationName = ddlStoreLocationID.SelectedItem.ToString(); //model.StoreLocation = stloc; } catch { //userGroup.StoreLocation = null; userGroup.StoreLocationType = null; } #endregion #region Get Operations foreach (var oper in userGroup.Operations) { userGroup.Operations.Remove(oper); } foreach (GridViewRow row in GridView1.Rows) { CheckBox chkOp = (CheckBox)row.FindControl("chkSelected"); object oid = ((GridView)row.Parent.Parent).DataKeys[row.RowIndex].Value; Operation op = new Operation(); op.OperationID = Convert.ToInt32(oid); if (chkOp.Checked) { userGroup.Operations.Add(op); } GridView gvToolbar = (GridView)row.FindControl("gvOperation"); if (gvToolbar != null) { foreach (GridViewRow gvRow in gvToolbar.Rows) { Operation oper = new Operation(); oper.OperationID = Convert.ToInt32(gvToolbar.DataKeys[gvRow.RowIndex].Value); CheckBox chk = (CheckBox)gvRow.FindControl("chkSelected"); if (chk.Checked) { userGroup.Operations.Add(oper); } } } } #region two gridview implementation #endregion Session.Remove(SessionOperations); Session[SessionOperations] = userGroup.Operations; #endregion if (this.hidGroupID.Value.Length > 0) { userGroup.GroupID = int.Parse(this.hidGroupID.Value); Service.UpdateUserGroup(userGroup); } else { UserGroup temp = new UserGroup(); temp.GroupName = userGroup.GroupName; if (Service.ExistUserGroup(temp)) { RegisterStartupScript("Message", "<script>alert('该用户组名称已存在');</script>"); return; } else { userGroup.CreateDate = DateTime.Now; userGroup = Service.AddUserGroup(userGroup); // this.hidGroupID.Value = model.GroupID.ToString(); Response.Write("<script>window.location.href='UserGroupList.aspx';</script>"); } } ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "closeDialogOnSave();", true); }
public bool ExistStoreLocationType(StoreLocationType model) { return(Channel.ExistStoreLocationType(model)); }
public void DeleteStoreLocationType(StoreLocationType model) { Channel.DeleteStoreLocationType(model); }
public StoreLocationType AddStoreLocationType(StoreLocationType model) { return(Channel.AddStoreLocationType(model)); }
public void UpdateStoreLocationType(StoreLocationType model) { Channel.UpdateStoreLocationType(model); }
public StoreLocationType GetStoreLocationTypeByKey(StoreLocationType info) { return(Channel.GetStoreLocationTypeByKey(info)); }
public List <StoreLocationType> QueryStoreLocationTypesByPage(StoreLocationType info, int pageSize, int pageNumber, out int pageCount, out int itemCount) { return(Channel.QueryStoreLocationTypesByPage(info, pageSize, pageNumber, out pageCount, out itemCount)); }
public List <StoreLocationType> QueryStoreLocationTypes(StoreLocationType info) { return(Channel.QueryStoreLocationTypes(info)); }