/// <summary> /// Bind Grid /// </summary> private void BindTemplatesGrid() { int pageSize = AspNetPager1.PageSize; int pageIndex = PageIndex; string queryCondition = GenerateQueryCondition(); int recordCount = 0; DataSet tpLists = null; DataTable dtList = null; try { tpLists = template.GetTemplateWorkflows(pageSize, pageIndex, queryCondition, out recordCount, OrderName, OrderType); if (!tpLists.Tables[0].Columns.Contains("Stages")) { tpLists.Tables[0].Columns.Add("Stages"); } if (!tpLists.Tables[0].Columns.Contains("Custom_Cov")) { tpLists.Tables[0].Columns.Add("Custom_Cov"); } if (!tpLists.Tables[0].Columns.Contains("Default_Cov")) { tpLists.Tables[0].Columns.Add("Default_Cov"); } if (!tpLists.Tables[0].Columns.Contains("Enabled_Cov")) { tpLists.Tables[0].Columns.Add("Enabled_Cov"); } Template_Wfl_Stages stage; DataSet ds; string sName = ""; string Default_Type = ""; int search_idx = -1; int iWflTempId = 0; Template_Workflow WorkflowTemplateManager = new Template_Workflow(); foreach (DataRow dr in tpLists.Tables[0].Rows) { if (dr["WflTemplId"] != DBNull.Value) { iWflTempId = (int)dr["WflTemplId"]; } if ((dr["Name"] != DBNull.Value) && (dr["Name"].ToString() != "")) { sName = (string)dr["Name"]; if (sName != null) { sName = sName.ToLower(); search_idx = sName.IndexOf("prospect"); if (search_idx >= 0) { Default_Type = "Prospect"; } else { Default_Type = "Processing"; } } } if (dr["WorkflowType"] == DBNull.Value || dr["WorkflowType"].ToString() == "") { //Default Processing dr["WorkflowType"] = Default_Type; WorkflowTemplateManager.UpdateWorkflowType(iWflTempId, Default_Type); } if (dr["Default"] == DBNull.Value || dr["Default"].ToString() == "" || dr["Default"].ToString() == "0" || dr["Default"].ToString() == "False") { //Default No dr["Default_Cov"] = "No"; } else { dr["Default_Cov"] = "Yes"; } if (dr["Custom"] == DBNull.Value || dr["Custom"].ToString() == "" || dr["Custom"].ToString() == "0" || dr["Custom"].ToString() == "False") { //Default Standard dr["Custom_Cov"] = "Standard"; } else { dr["Custom_Cov"] = "Custom"; } if (dr["Enabled"] == DBNull.Value || dr["Enabled"].ToString() == "" || dr["Enabled"].ToString() == "0" || dr["Enabled"].ToString() == "False") { dr["Enabled_Cov"] = "No"; } else { dr["Enabled_Cov"] = "Yes"; } stage = new Template_Wfl_Stages(); ds = stage.GetList(0, "WflTemplId = " + dr["WflTemplId"].ToString(), "SequenceNumber"); dr["Stages"] = ds.Tables[0].Rows.Count; } if (OrderName == "Stages") { DataView dv = tpLists.Tables[0].DefaultView; dv.Sort = "Stages " + SortType; dtList = dv.ToTable(); } else { tpLists.AcceptChanges(); dtList = tpLists.Tables[0]; } } catch (Exception exception) { LPLog.LogMessage(exception.Message); } AspNetPager1.PageSize = pageSize; AspNetPager1.RecordCount = recordCount; gvWorkFolwList.DataSource = dtList; gvWorkFolwList.DataBind(); }