Esempio n. 1
0
        /// <summary>
        /// method to bind data to ModuleDropDownList from database
        /// </summary>
        public void getModule()
        {
            WorkFlowBO   objWorkFlow     = new WorkFlowBO();
            WorkFlowBLL  WorkFlowBLLobj  = new WorkFlowBLL();
            WorkFlowList objWorkFlowList = new WorkFlowList();

            objWorkFlowList = WorkFlowBLLobj.getAllModule();


            ModuleDropDownList.DataSource     = objWorkFlowList;//dt.Tables[0];
            ModuleDropDownList.DataTextField  = "MODULENAME";
            ModuleDropDownList.DataValueField = "MODULEID";
            ModuleDropDownList.DataBind();
            ModuleDropDownList.Items.Insert(0, new ListItem("-- Select --", "0"));
            ModuleDropDownList.SelectedIndex = 0;
        }
Esempio n. 2
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdWorkflowItem_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["WorkFlowDefID"] = e.CommandArgument;
                WorkFlowBO  objWorkFlowBO  = new WorkFlowBO();
                WorkFlowBLL objWorkFlowBLL = new WorkFlowBLL();
                objWorkFlowBO = objWorkFlowBLL.GetWorkFlowDefByID(Convert.ToInt32(ViewState["WorkFlowDefID"]));
                //Editing set the value to the respective dropDown box and textbox
                if (objWorkFlowBO != null)
                {
                    ModuleDropDownList.ClearSelection();
                    if (ModuleDropDownList.Items.FindByValue(objWorkFlowBO.ModuleID.ToString()) != null)
                    {
                        ModuleDropDownList.Items.FindByValue(objWorkFlowBO.ModuleID.ToString()).Selected = true;
                    }

                    getWorkfolwitemByModuleID();

                    WorkflowItemDropDownList.ClearSelection();
                    if (WorkflowItemDropDownList.Items.FindByValue(objWorkFlowBO.WorkflowID.ToString()) != null)
                    {
                        WorkflowItemDropDownList.Items.FindByValue(objWorkFlowBO.WorkflowID.ToString()).Selected = true;
                    }

                    getAllRole();

                    HightAuthDropDownList.ClearSelection();
                    if (HightAuthDropDownList.Items.FindByValue(objWorkFlowBO.HigherAuthorityID.ToString()) != null)
                    {
                        HightAuthDropDownList.Items.FindByValue(objWorkFlowBO.HigherAuthorityID.ToString()).Selected = true;
                    }

                    getLevel();

                    ApproverLevelDropDownList.ClearSelection();
                    if (ApproverLevelDropDownList.Items.FindByValue(objWorkFlowBO.ApprovalID.ToString()) != null)
                    {
                        ApproverLevelDropDownList.Items.FindByValue(objWorkFlowBO.ApprovalID.ToString()).Selected = true;
                    }
                    getLevel();
                    TriggerDropDownList.ClearSelection();
                    if (TriggerDropDownList.Items.FindByValue(objWorkFlowBO.Trigger.ToString()) != null)
                    {
                        TriggerDropDownList.Items.FindByValue(objWorkFlowBO.Trigger.ToString()).Selected = true;
                    }

                    AfterDropDownList.ClearSelection();
                    if (AfterDropDownList.Items.FindByValue(objWorkFlowBO.AfterDays.ToString()) != null)
                    {
                        AfterDropDownList.Items.FindByValue(objWorkFlowBO.AfterDays.ToString()).Selected = true;
                    }
                    if (HightAuthDropDownList.SelectedIndex > 0)
                    {
                        TriggerDropDownList.Enabled = true;
                        AfterDropDownList.Enabled   = true;
                    }
                    else
                    {
                        TriggerDropDownList.Enabled = false;
                        AfterDropDownList.Enabled   = false;
                    }
                    WORKFLOWDEFINITIONIDTextBox.Text = objWorkFlowBO.WorkFlowDefID.ToString();
                    SaveButton.Text  = "Update";
                    ClearButton.Text = "Cancel";
                }
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                //Delete the record using WorkflowDefID
                string message = string.Empty;

                WorkFlowBLL objWorkFlowBLL = new WorkFlowBLL();
                message = objWorkFlowBLL.DeleteWorkFlowDef(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Deleted successfully";
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                BindGridWorkFlowDefinition();
                clear();
                SetUpdateMode(false);
            }
            else if (e.CommandName == "ClickAddApproved")
            {
                // ViewState["WorkFlowDefID"] = e.CommandArgument;
                GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
                Literal     WorkflowApproverID = (Literal)row.FindControl("litWorkFlowDefID"); //Literal value avaiable in the grid
                Literal     LitModuleName      = (Literal)row.FindControl("LitModuleName");
                Literal     LitWorkflowName    = (Literal)row.FindControl("LitWorkflowName");
                // WorkFlowDefIDTextBox.Text = WorkflowApproverID.Text;
                ViewState["WorkFlowDefID"] = WorkflowApproverID.Text; //view state value assigned by the help of Literal
                WorkFlowDefID(WorkflowApproverID.Text);
                ApprovalTable.Visible = true;                         //Approver Screen Visable
                ApproverTab.InnerText = "Approvers For " + LitModuleName.Text + "-" + LitWorkflowName.Text;
                #region For load data to Dropen down approval
                BindGrid(true, true);
                if (ViewState["StatusMode"].ToString() != "ReadOnly")
                {
                    ADDButton.Visible    = true;
                    UpDateButton.Visible = false;
                    CancelButton.Visible = false;
                }
                WorkApproverIDTextBox.Text = "0";
                WorkDefinationTextBox.Text = "0";
                getAllRole();
                getLevel();
                ListItem lstItem = ApproverNameDropDownList.Items[0];
                ApproverNameDropDownList.Items.Clear();
                ApproverNameDropDownList.Items.Insert(0, lstItem);
                ApproverLevelDropDownList.Enabled = true;
                #endregion

                BindGrid(true, true); // Calling Approval Bind Grid Data
            }
        }