public void Invoke(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string[] elemsToDelete = MCGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]); if (elemsToDelete.Length > 1) { using (DbTransaction tran = DbTransaction.Begin()) { for (int i = 0; i < elemsToDelete.Length - 1; i++) { for (int j = i + 1; j < elemsToDelete.Length; j++) { int id1 = Convert.ToInt32(elemsToDelete[i].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture); int id2 = Convert.ToInt32(elemsToDelete[j].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture); if (id1 > 0 && id2 > 0) { Project2.AddRelation(id1, id2); } } } tran.Commit(); } CHelper.RequireBindGrid(); } } }
public void Invoke(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; int prjId = int.Parse(cp.CommandArguments["ObjectId"]); if (cp.CommandArguments.ContainsKey("SelectedValue")) { string[] elemsToAdd = cp.CommandArguments["SelectedValue"].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); using (DbTransaction tran = DbTransaction.Begin()) { foreach (string elem in elemsToAdd) { int selectedValue = 0; if (int.TryParse(elem, out selectedValue)) { Project2.AddRelation(prjId, selectedValue); } } tran.Commit(); } } CHelper.RequireBindGrid(); } }
protected void Add_Click(object sender, System.EventArgs e) { int RelProjectId = int.Parse(hdnProjectId.Value); if (ProjectId > 0 && ProjectId != RelProjectId) { Project2.AddRelation(ProjectId, RelProjectId); } CommandParameters cp = new CommandParameters("MC_PM_Redirect"); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); }
protected void Add_Click(object sender, System.EventArgs e) { int RelProjectId = int.Parse(hdnProjectId.Value); if (ProjectId > 0) { Project2.AddRelation(ProjectId, RelProjectId); Response.Redirect("../Projects/ProjectView.aspx?Tab=1&ProjectId=" + ProjectId); } else { ProjectGroup.AssignProjectGroup(RelProjectId, PGID); Response.Redirect("../Projects/ProjectGroupView.aspx?ProjectGroupId=" + PGID); } }
protected void btnAddRelatedPrj_Click(object sender, EventArgs e) { string param = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(param)) { string[] mas = param.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (mas.Length < 2 || !mas[0].Equals("3")) { return; } int iRelId = int.Parse(mas[1]); Project2.AddRelation(ProjectId, iRelId); Response.Redirect("~/Projects/ProjectView.aspx?ProjectId=" + ProjectId + "&Tab=1", true); } }
void btnAddRelatedPrj_Click(object sender, EventArgs e) { string param = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(param)) { string[] mas = param.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (mas.Length < 2 || !mas[0].Equals("3")) { return; } int iRelId = int.Parse(mas[1]); Project2.AddRelation(ProjectId, iRelId); BindDG(); } }