public void Invoke(object sender, object element) { if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; //if (!cp.CommandArguments.ContainsKey("ControlId")) // throw new ArgumentNullException("CommandParameters.ControlId @ GoogleGadgetRefresh"); //string _cid = cp.CommandArguments["ControlId"]; if (HttpContext.Current.Session["ControlId"] == null) { throw new ArgumentNullException("Session.ControlId @ GoogleGadgetRefresh"); } string _cid = HttpContext.Current.Session["ControlId"].ToString(); string id = MetaViewGroupUtil.GetIdFromUniqueKey(cp.CommandArguments["primaryKeyId"]); HttpRequest request = HttpContext.Current.Request; if (request != null) { GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(id)); ControlProperties.Provider.SaveValue(_cid, "PageSource", id); if (gge != null) { ControlProperties.Provider.SaveValue(_cid, ControlProperties._titleKey, CHelper.GetResFileString(gge.Title)); } CommandParameters cp2 = new CommandParameters("MC_GG_SelectItem"); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(((CommandManager)sender).Page, cp2.ToString()); //((CommandManager)sender).Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "", true); } } }
protected void lbAddItems_Click(object sender, EventArgs e) { string s = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(s)) { string[] mas = s.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); PrimaryKeyId objId = PrimaryKeyId.Parse(Request["ObjectId"]); foreach (string item in mas) { PrimaryKeyId id = PrimaryKeyId.Parse(MetaViewGroupUtil.GetIdFromUniqueKey(item)); string className = MetaViewGroupUtil.GetMetaTypeFromUniqueKey(item); if (!String.IsNullOrEmpty(className) && className != MetaViewGroupUtil.keyValueNotDefined) { EntityObject eo = BusinessManager.Load(className, id); if (eo != null && !String.IsNullOrEmpty(FilterFieldName) && eo.Properties[FilterFieldName] != null) { eo[FilterFieldName] = objId; BusinessManager.Update(eo); } } } CHelper.RequireDataBind(); } }
protected void lbSave_Click(object sender, EventArgs e) { btnSave.Disabled = true; btnCancel.Disabled = true; CommandParameters cp = new CommandParameters("MC_MUI_EntityDD"); if (Request["ReturnCommand"] != null) { cp.CommandName = Request["ReturnCommand"]; } cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>(); cp.AddCommandArgument("ClassName", ddFilter.SelectedValue); if (Request["ObjectId"] != null) { cp.AddCommandArgument("ObjectId", Request["ObjectId"]); } if (Request["GridId"] != null) { cp.AddCommandArgument("GridId", Request["GridId"]); } if (TreeServiceTargetObjectId != PrimaryKeyId.Empty) { cp.AddCommandArgument("TreeServiceTargetObjectId", TreeServiceTargetObjectId.ToString()); } cp.AddCommandArgument("SelectedValue", hdnValue.Value); if (!String.IsNullOrEmpty(Request["SelectCtrlId"])) { string[] mas = hdnValue.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (mas.Length > 0) { string uid = MetaViewGroupUtil.GetIdFromUniqueKey(mas[0]); if (uid != "null") { cp.AddCommandArgument("SelectObjectId", uid); cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]); cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue); cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, PrimaryKeyId.Parse(uid))); } } } Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); }
/// <summary> /// Handles the Click event of the lbAddItems control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void lbAddItems_Click(object sender, EventArgs e) { string s = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(s)) { string[] mas = s.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in mas) { PrimaryKeyId id = PrimaryKeyId.Parse(MetaViewGroupUtil.GetIdFromUniqueKey(item)); this.Value = MetaViewGroupUtil.GetIdFromUniqueKey(item); string className = MetaViewGroupUtil.GetMetaTypeFromUniqueKey(item); EntityObject obj = BusinessManager.Load(className, id); MetaClass mc = MetaDataWrapper.GetMetaClassByName(obj.MetaClassName); lblValue.Text = obj.Properties[mc.TitleFieldName].Value.ToString(); } this.RaiseBubbleEvent(this, e); } }
protected void lbAddClient_Click(object sender, EventArgs e) { string s = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(s)) { DataTable dt = (DataTable)ViewState["Participants"]; string[] mas = s.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string contact in mas) { PrimaryKeyId id = PrimaryKeyId.Parse(MetaViewGroupUtil.GetIdFromUniqueKey(contact)); ContactEntity contactEntity = (ContactEntity)BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), id); if (contactEntity != null && (!String.IsNullOrEmpty(contactEntity.EMailAddress1) || !String.IsNullOrEmpty(contactEntity.EMailAddress2) || !String.IsNullOrEmpty(contactEntity.EMailAddress3))) { DataRow dr = dt.NewRow(); int iIndex = int.Parse(hdnCurrent.Value); dr["EMailIssueExternalRecipientId"] = --iIndex; hdnCurrent.Value = iIndex.ToString(); if (!String.IsNullOrEmpty(contactEntity.EMailAddress1)) { dr["EMail"] = contactEntity.EMailAddress1; } else if (!String.IsNullOrEmpty(contactEntity.EMailAddress2)) { dr["EMail"] = contactEntity.EMailAddress2; } else if (!String.IsNullOrEmpty(contactEntity.EMailAddress3)) { dr["EMail"] = contactEntity.EMailAddress3; } dt.Rows.Add(dr); } } ViewState["Participants"] = dt; BinddgMemebers(); } }
protected void lbAddItems_Click(object sender, EventArgs e) { string s = Request["__EVENTARGUMENT"]; if (!String.IsNullOrEmpty(s)) { string[] mas = s.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); PrimaryKeyId objId = PrimaryKeyId.Parse(Request["ObjectId"]); foreach (string item in mas) { PrimaryKeyId id = PrimaryKeyId.Parse(MetaViewGroupUtil.GetIdFromUniqueKey(item)); string className = MetaViewGroupUtil.GetMetaTypeFromUniqueKey(item); if (!String.IsNullOrEmpty(className) && className != MetaViewGroupUtil.keyValueNotDefined) { FilterElementCollection fec = new FilterElementCollection(); fec.Add(FilterElement.EqualElement(Filter1FieldName, PrimaryKeyId.Parse(Request["ObjectId"]))); fec.Add(FilterElement.EqualElement(Filter2FieldName, id)); EntityObject[] list = BusinessManager.List(BridgeClassName, fec.ToArray()); if (list.Length == 0) { EntityObject eo = BusinessManager.InitializeEntity(BridgeClassName); eo[Filter1FieldName] = PrimaryKeyId.Parse(Request["ObjectId"]); eo[Filter2FieldName] = id; BusinessManager.Create(eo); } } else if (id != PrimaryKeyId.Empty) { EntityObject eo = BusinessManager.InitializeEntity(BridgeClassName); eo[Filter1FieldName] = PrimaryKeyId.Parse(Request["ObjectId"]); eo[Filter2FieldName] = id; BusinessManager.Create(eo); } } CHelper.RequireDataBind(); } }
public void Invoke(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string[] elems = null; if (cp.CommandArguments.ContainsKey("GridId")) { elems = MetaGridServer.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]); } List <int> ttbIds = new List <int>(); //fix by DV: 2008-05-14 //Esli vyzyvaetsa s grida (iconka v otklonennih listah), to primitiv v gride ustanovit etot flag //i togda ID budet bratsa iz parametrov, v protivnom sluchae ID - beretsa iz checkboxes if (!cp.CommandArguments.ContainsKey("callFromGrid")) { foreach (string elem in elems) { string type = MetaViewGroupUtil.GetMetaTypeFromUniqueKey(elem); // elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[1]; if (type == MetaViewGroupUtil.keyValueNotDefined) { continue; } int id = Convert.ToInt32(MetaViewGroupUtil.GetIdFromUniqueKey(elem), CultureInfo.InvariantCulture); //Convert.ToInt32(elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0], CultureInfo.InvariantCulture); if (type == TimeTrackingEntry.GetAssignedMetaClass().Name) { //TimeTrackingEntry tte = MetaObjectActivator.CreateInstance<TimeTrackingEntry>(TimeTrackingEntry.GetAssignedMetaClass(), id); //if (!ttbIds.Contains(tte.ParentBlockId)) // ttbIds.Add(tte.ParentBlockId); } else { if (!ttbIds.Contains(id)) { ttbIds.Add(id); } } } } else { ttbIds.Add(Convert.ToInt32(MetaViewGroupUtil.GetIdFromUniqueKey(cp.CommandArguments["primaryKeyId"]), CultureInfo.InvariantCulture)); } using (TransactionScope tran = DataContext.Current.BeginTransaction()) { foreach (int ttbId in ttbIds) { TimeTrackingBlock ttb = MetaObjectActivator.CreateInstance <TimeTrackingBlock>(TimeTrackingBlock.GetAssignedMetaClass(), ttbId); StateMachineService sms = ((BusinessObject)ttb).GetService <StateMachineService>(); // process only initial state if (sms.StateMachine.GetStateIndex(sms.CurrentState.Name) == 0) { StateTransition[] availableTransitions = sms.GetNextAvailableTransitions(true); if (availableTransitions.Length > 0) { sms.MakeTransition(availableTransitions[0].Uid); ttb.Save(); } } } tran.Commit(); } } }