Ejemplo n.º 1
0
 public bool SetStages(DataViewSetupInfo stages)
 {
     try
     {
         bool status = ControlPanelWriteHelper.SetStages(stages);
         return(status);
     }
     catch (Exception ex)
     {
         EventLogger.LogEvent(SysEventType.ERROR.ToString(), "Error", "set Stages failed with exception", ex);
         throw;
     }
 }
Ejemplo n.º 2
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            string            relation1    = Constants.DelimeterSinglePipe + Teams.Where(x => x.Selected).Select(a => a.Value).ToList().ToCharSeperatedString(Constants.DelimeterSinglePipe);
            DataViewSetupInfo stageMasters = new DataViewSetupInfo();

            stageMasters.Add(new DataViewSetup
            {
                DataType     = Type,
                Id           = StageId,
                Stage        = StageName,
                Relation1    = relation1,
                Relation2    = SubLink,
                ActionLink   = Link,
                Suspend      = false,
                Referances   = ReferencesData,
                DataBaseInfo = UserContext.DataBaseInfo,
                Action       = Action
            });
            if (_controlPanel.SetStages(stageMasters))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.StageMasterSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Stage MASTER SAVED",
                                  GlobalCustomResource.StageMasterSaved, true);
                ClearForm();
                DivAction = false;
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.StageMasterFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Stage MASTER UPDATE FAILED",
                                  GlobalCustomResource.StageMasterFailed, true);
            }
        }
Ejemplo n.º 3
0
 public DataViewTemplate()
 {
     BasicInfo = new DataViewBasicInfo();
     SetupInfo = new DataViewSetupInfo();
 }
Ejemplo n.º 4
0
        public void BindStages(DataViewSetupInfo stages)
        {
            if (stages == null)
            {
                return;
            }
            var frStages = stages.Where(x => x.Relation2.Trim() == SubLink).ToList();
            var tabs     = ulTabs.Controls.All()
                           .Where(c => c.ID != null && c.ID.Contains("liTab") &&
                                  Convert.ToInt16(c.ID.Replace("liTab", string.Empty)) > frStages.Count);

            foreach (var tab in tabs)
            {
                tab.Visible = false;
            }

            var activeTabs = ulTabs.Controls.All()
                             .Where(c => c.ID != null && c.ID.Contains("lnkTab") &&
                                    Convert.ToInt16(c.ID.Replace("lnkTab", string.Empty)) <= frStages.Count)
                             .OrderBy(x => x.ID);

            var dataIndex = 0;
            var dataArray = frStages.ToArray();

            if (frStages.Where(x => x.Stage.Trim() == ActiveStage).ToList().Count == 0)
            {
                var Actionlnk = frStages.FirstOrDefault().ActionLink.IndexOf('?') == -1 ? dataArray[dataIndex].ActionLink.ToString().Trim() + "?Stage=" + frStages.FirstOrDefault().Stage + "&SubLinkType=" + SubLink
                                                                                                 : dataArray[dataIndex].ActionLink.ToString().Trim() + "&Stage=" + frStages.FirstOrDefault().Stage + "&SubLinkType=" + SubLink;
                /// Response.Redirect(Actionlnk);
                Response.Redirect(Actionlnk, false);
                Context.ApplicationInstance.CompleteRequest();
            }
            foreach (var tab in activeTabs)
            {
                ((LinkButton)tab).CommandArgument = dataArray[dataIndex].Stage;
                ((LinkButton)tab).Text            = dataArray[dataIndex].FieldDescription;
                ((LinkButton)tab).PostBackUrl     = dataArray[dataIndex].ActionLink.IndexOf('?') == -1 ? dataArray[dataIndex].ActionLink.ToString().Trim() + "?Stage=" + dataArray[dataIndex].Stage + "&SubLinkType=" + SubLink
                                                                                                : dataArray[dataIndex].ActionLink.ToString().Trim() + "&Stage=" + dataArray[dataIndex].Stage + "&SubLinkType=" + SubLink;

                //var request = (HttpWebRequest)WebRequest.Create(dataArray[dataIndex].ActionLink.ToString().Trim());
                //var postData = "Stage=" + dataArray[dataIndex].Stage;
                //var data = Encoding.ASCII.GetBytes(postData);
                //request.Method = "POST";
                //request.ContentType = "application/x-www-form-urlencoded";
                //request.ContentLength = data.Length;
                //using (var stream = request.GetRequestStream())
                //{
                //    stream.Write(data, 0, data.Length);
                //}
                //var response = (HttpWebResponse)request.GetResponse();

                //var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                //((LinkButton)tab).PostBackUrl = responseString;

                if (ActiveStage == dataArray[dataIndex].Stage.Trim())
                {
                    var li      = tab.Parent as HtmlGenericControl;
                    var liClass = li.Attributes["class"].ToString();
                    li.Attributes["class"] = liClass + " active";
                    // ((LinkButton)tab).CssClass = "tab active";
                }
                else
                {
                    var li      = tab.Parent as HtmlGenericControl;
                    var liClass = li.Attributes["class"].ToString();
                    li.Attributes["class"] = liClass.Replace(" active", string.Empty);
                }
                dataIndex++;
            }
        }