public List <Request_Buttons> GetAllAvailableButtons(long template_id) { string host = _entity.tb_Hostaddress.Where(x => x.IsActive == true).FirstOrDefault().Host_Address; var data = _entity.tb_WF_Template.Where(x => x.Id == template_id && x.IsActive == true).FirstOrDefault(); List <Request_Buttons> lists = new List <Request_Buttons>(); //Basheer on 14-03-2020 changed list to lists if (data != null) { if (data.Button_List != null) { foreach (var item in data.Button_List.Split('~').ToList()) { var button = _entity.tb_Button.Where(x => x.Code.Trim().ToLower() == item.ToLower().Trim() && x.IsActive == true).FirstOrDefault(); //Added order by on 13-03-2020 by basheer if (button != null) { Request_Buttons one = new Request_Buttons(); one.button_code = button.Code.Trim(); one.button_name = button.Description; one.button_image = host + button.Button_Image; one.have_additional_info = button.Have_Additional_Info; one.buttonorder = button.Button_Order; //Added by basheer on 14-03-2020 lists.Add(one); } } } } var list = lists.OrderBy(x => x.buttonorder).ToList(); return(list); }
public List <Request_Buttons> GetAllAvailableProcessButtons(string requestid, string roleid, string wf_Id) //Basheer on 28-05-2020 copy paste entire items { string[] splitData = requestid.Split('-'); long reqid = Convert.ToInt32(splitData[1]); long wf_type_id = 0; if (wf_Id != "") { wf_type_id = Convert.ToInt32(wf_Id); } string host = _entity.tb_Hostaddress.Where(x => x.IsActive == true).FirstOrDefault().Host_Address; var data = _entity.tb_ProcessHdr.Where(x => x.RequestId == reqid && x.IsActive == true && x.IsCompleted == false && x.RoleId == roleid && x.WF_id == wf_type_id).ToList(); //Basheer on 28-05-2020 List <Request_Buttons> list = new List <Request_Buttons>(); if (data.Count() != 0) //Basheer on 07-07-2020 { foreach (var btn in data) { if (btn.Button_List != null) { foreach (var item in btn.Button_List.Split('~').ToList()) { var button = _entity.tb_Button.Where(x => x.Code.Trim().ToLower() == item.ToLower().Trim() && x.IsActive == true).FirstOrDefault(); if (button != null) { Request_Buttons one = new Request_Buttons(); one.button_code = button.Code.Trim(); one.button_name = button.Description; one.button_image = host + button.Button_Image; one.have_additional_info = button.Have_Additional_Info; one.processId = btn.Id;//Basheer on 28-05-2020 list.Add(one); } } } } } else { var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //added order by on 13-03-2020 basheer if (button != null) { foreach (var item in button) { Request_Buttons one = new Request_Buttons(); one.button_code = item.Code.Trim(); one.button_name = item.Description; one.button_image = host + item.Button_Image; one.have_additional_info = item.Have_Additional_Info; list.Add(one); } } } return(list); }
//Basheer on 04-02-2020 for buttons for initator with status BKI public List <Request_Buttons> GetAllAvailableButtonsBKI(string requestid) { string host = _entity.tb_Hostaddress.Where(x => x.IsActive == true).FirstOrDefault().Host_Address; string[] splitData = requestid.Split('-'); string reqid = splitData[1]; var data = _entity.tb_Request_Hdr.Where(x => x.Request_ID == reqid && x.IsActive == true).FirstOrDefault(); List <Request_Buttons> list = new List <Request_Buttons>(); if (data != null) { if (data.Approval_No != "0") { var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW" || x.Code.Trim().ToLower() == "SUT") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //Added order by on 13-03-2020 by basheer if (button != null) { foreach (var item in button) { Request_Buttons one = new Request_Buttons(); one.button_code = item.Code.Trim(); one.button_name = item.Description; one.button_image = host + item.Button_Image; one.have_additional_info = item.Have_Additional_Info; list.Add(one); } } } else { var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW" || x.Code.Trim().ToLower() == "CNL" || x.Code.Trim().ToLower() == "SUT") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //Added order by on 13-03-2020 by basheer if (button != null) { foreach (var item in button) { Request_Buttons one = new Request_Buttons(); one.button_code = item.Code.Trim(); one.button_name = item.Description; one.button_image = host + item.Button_Image; one.have_additional_info = item.Have_Additional_Info; list.Add(one); } } } } return(list); }
//Basheer on 14-03-2020 for refreshing pages public List <Request_Buttons> GetAllAvailableButtonsRefresh(string requestid) { string host = _entity.tb_Hostaddress.Where(x => x.IsActive == true).FirstOrDefault().Host_Address; string[] splitData = requestid.Split('-'); string reqid = splitData[1]; var data = _entity.tb_Request_Hdr.Where(x => x.Request_ID == reqid && x.IsActive == true).FirstOrDefault(); List <Request_Buttons> list = new List <Request_Buttons>(); if (data != null) { if (data.Approval_No != "1" || data.Approval_No == "0" || data.Status_ID == "CNL" || data.Status_ID == "CLS" || data.Status_ID == "REJ") //Terrin on 15/6/2020 { var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //added order by on 13-03-2020 basheer if (button != null) { foreach (var item in button) { Request_Buttons one = new Request_Buttons(); one.button_code = item.Code.Trim(); one.button_name = item.Description; one.button_image = host + item.Button_Image; one.have_additional_info = item.Have_Additional_Info; list.Add(one); } } } else { var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW" /*|| x.Code.Trim().ToLower() == "CNL"*/) && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //Added order by on 13-03-2020 by basheer //Terrin 15/6/2020 if (button != null) { foreach (var item in button) { Request_Buttons one = new Request_Buttons(); one.button_code = item.Code.Trim(); one.button_name = item.Description; one.button_image = host + item.Button_Image; one.have_additional_info = item.Have_Additional_Info; list.Add(one); } } } //Basheer on 28-03-2020 //if (data.Status_ID == "CNL") //{ // var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //added order by on 13-03-2020 basheer // if (button != null) // { // foreach (var item in button) // { // Request_Buttons one = new Request_Buttons(); // one.button_code = item.Code.Trim(); // one.button_name = item.Description; // one.button_image = host + item.Button_Image; // one.have_additional_info = item.Have_Additional_Info; // list.Add(one); // } // } //} //else //{ // var button = _entity.tb_Button.Where(x => (x.Code.Trim().ToLower() == "PRN" || x.Code.Trim().ToLower() == "EFW") && x.IsActive == true).OrderBy(x => x.Button_Order).ToList(); //Added order by on 13-03-2020 by basheer // if (button != null) // { // foreach (var item in button) // { // Request_Buttons one = new Request_Buttons(); // one.button_code = item.Code.Trim(); // one.button_name = item.Description; // one.button_image = host + item.Button_Image; // one.have_additional_info = item.Have_Additional_Info; // list.Add(one); // } // } //} //Basheer code end here } return(list); }