public static string AllSearch2(int dd, string txt, int lg) { DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_AllSearchRequest2", new SqlParameter[] { new SqlParameter("@dd", dd), new SqlParameter("@Stext", txt) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); r.REQUEST_COMMENT = item["REQUEST_COMMENT"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ATRIBUTE = (Convert.ToInt32(item["LOG_IN_ID"]) == lg) ? "Curr" : "NotC"; r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; r.COMMENT_FILE = item["PAYMENT"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string GetRequestTable(int LogId) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("GetRequestTable", new SqlParameter[] { new SqlParameter("@L", LogId) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = (item["INDIVIDUAL_ID"] == DBNull.Value)?-1: Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.REQUEST_COMMENT = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (item["ORDER"].ToString() == "1") ? true : false; //(bool)item["EMERGENCY_TREATMENT"]; r.ADRESS = item["OBJECT_ADRESS"].ToString(); r.MOBILE_NUMBER = item["MOBILE_NUMBER"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string AllSearch1(int dd, string txt, int lg) { DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_AllSearchRequest", new SqlParameter[] { new SqlParameter("@dd", dd), new SqlParameter("@Stext", txt) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.ROOM_NUMBER = item["ROOM_NUMBER"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ATRIBUTE = (item["LOG_IN_ID"] != lg.ToString() || item["LOG_IN_ID"] == null) ? "NotC" : "Curr"; //r.DELIVERY_TYPE_ID = 1; r.ADRESS = item["OBJECT_ADRESS"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; r.COMMENT_FILE = item["PAYMENT"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string GetOtcet(int log, string CrFrom, string CrTo) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("usp_DispReportRequestTypesCount", new SqlParameter[] { new SqlParameter("@lg", log), new SqlParameter("@from", CrFrom), new SqlParameter("@to", CrTo) }, CommandType.StoredProcedure); Random r = new Random(); int rand = r.Next(); string startupPath = @"C:\inetpub\wwwroot\"; //AppDomain.CurrentDomain.BaseDirectory; string filePath = startupPath + @"Disp_Admin\excelOt\" + rand.ToString() + ".csv"; string virtPath = @"excelOt/" + rand.ToString() + ".csv"; //workbook.SaveAs(filePath); string strbuld = GenerateCSV(dt); File.WriteAllText(filePath, strbuld, Encoding.UTF8); List <Request> rs = new List <Utilities.Request>(); Request r_ = new Utilities.Request(); r_.ACCOUNT_NAME = virtPath; rs.Add(r_); JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs));// @"[{Path : "+filePath+"}]"; }
public static string SearchRequest1(int lg, string Stxt) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("SearchRequest1", new SqlParameter[] { new SqlParameter("@Stext", Stxt), new SqlParameter("@logId", lg) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); if (dt.Rows.Count != 0) { foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.REQUEST_COMMENT = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; rs.Add(r); } } else { System.Data.DataTable dt_1 = Mydb.ExecuteReadertoDataTable("SerachForPServices_1", new SqlParameter[] { new SqlParameter("@lg", lg), new SqlParameter("@Stext", Stxt) }, CommandType.StoredProcedure); foreach (DataRow item in dt_1.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.REQUEST_COMMENT = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; rs.Add(r); } } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string AFilterin2(List <Kvorum_App.Disp_Admin.Utilities.Filter> flt, int Log) { string REQUEST_ID = ""; string ROOM_NUMBER = ""; string OBJECT_ID = ""; string ROOM_TYPE_ID = ""; string FIRST_NAME = ""; string STATUS_ID = ""; string CR_DATE_from = ""; string CR_DATEE_TO = ""; foreach (Kvorum_App.Disp_Admin.Utilities.Filter item in flt) { REQUEST_ID = (item.REQUEST_ID != 0) ? "REQUEST_ID=" + item.REQUEST_ID.ToString() : ""; ROOM_NUMBER = (item.ROOM_NUMBER != "0") ? "REQUEST_COMMENT like q%wroomwLw" + item.ROOM_NUMBER.ToString() + "w%q" : ""; ROOM_NUMBER = (ROOM_NUMBER != "") ? ROOM_NUMBER.Replace("q", "'").Replace("w", "\"").Replace("L", ":") : ""; OBJECT_ID = (item.OBJECT_ID != 0) ? "REQUEST_COMMENT like q%zObject_Idzw" + item.OBJECT_ID.ToString() + "%q" : ""; OBJECT_ID = (OBJECT_ID != "") ? OBJECT_ID.Replace("q", "'").Replace("z", "\"").Replace("w", ":") : ""; //ROOM_TYPE_ID = (item.ROOM_TYPE_ID != 0) ? "ROOM_TYPE_ID=" + item.ROOM_TYPE_ID.ToString() + "" : ""; FIRST_NAME = (item.FIRST_NAME != "") ? "REQUEST_COMMENT like q%windNamewLw" + item.FIRST_NAME + "w%q" : ""; FIRST_NAME = (FIRST_NAME != "") ? FIRST_NAME.Replace("q", "'").Replace("w", "\"").Replace("L", ":") : ""; STATUS_ID = (item.STATUSE != 0) ? "STATUS_ID=" + item.STATUSE.ToString() : ""; CR_DATE_from = (item.CR_DATE_FROM != "") ? string.Format("CR_DATE >=\"{0}\"", item.CR_DATE_FROM) : ""; CR_DATE_from = (CR_DATE_from != "") ? CR_DATE_from.Replace("\"", "'") : ""; CR_DATEE_TO = (item.CR_DATE_TO != "") ? string.Format("CR_DATE<=\"{0}\"", item.CR_DATE_TO) : ""; CR_DATEE_TO = (CR_DATEE_TO != "") ? CR_DATEE_TO.Replace("\"", "'") : ""; } string Clid = Mydb.ExecuteScalar("select CLIENT_ID from VW_ALL_REQUESTS_2 where LOG_IN_ID=@lg", new SqlParameter[] { new SqlParameter("@lg", Log) }, CommandType.Text).ToString(); string query = "select * from VW_ALL_REQUESTS_2 where CLIENT_ID=" + Clid + " " + ((REQUEST_ID != "") ? " and " + REQUEST_ID : " ") + " " + ((STATUS_ID != "") ? " and " + STATUS_ID : " ") + " " + ((CR_DATE_from != "") ? " and " + CR_DATE_from : " ") + " " + ((CR_DATEE_TO != "") ? " and " + CR_DATEE_TO : " ") + " " + ((ROOM_NUMBER != "") ? " and " + ROOM_NUMBER : " ") + " " + ((OBJECT_ID != "") ? " and " + OBJECT_ID : " ") + " " + ((FIRST_NAME != "") ? " and " + FIRST_NAME : " "); System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable(query, new SqlParameter[] { }, CommandType.Text); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); r.REQUEST_COMMENT = item["REQUEST_COMMENT"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.COMMENT_FILE = (Convert.ToInt32(item["LOG_IN_ID"]) == Log) ? "Curr" : "NoC"; rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string GetAllRequest(int Lg, int dd) { //DataTable dt = Mydb.ExecuteReadertoDataTable("select * from VW_ALL_REQUESTS_2 where DISP_ID=@dd", new SqlParameter[] { new SqlParameter("@dd", dd) }, CommandType.Text); List <Request> rs = new List <Utilities.Request>(); //foreach (DataRow item in dt.Rows) //{ // Request r = new Utilities.Request(); // r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); // r.CR_DATE = item["CR_DATE"].ToString(); // r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); // r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); // r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.REQUEST_COMMENT = item["REQUEST_COMMENT"].ToString(); // r.STATUS = item["STATUS"].ToString(); // r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); // r.STATUS_ID = item["STATUS_ID"].ToString(); // r.ATRIBUTE=(Convert.ToInt32(item["LOG_IN_ID"]) == Lg) ? "Curr" : "NotC"; // r.DELIVERY_TYPE_ID = 2; // r.COMMENT_FILE = item["PAYMENT"].ToString(); // r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; // rs.Add(r); //}select * from VW_ALL_REQUESTS where DISP_ID2=@ddSELECT * FROM VW_ALL_REQUESTS_1_2 WHERE DISP_ID2=@dd or DISP_ID=@dd2 order by CR_DATE desc DataTable dt2 = Mydb.ExecuteReadertoDataTable("GetAllRequests", new SqlParameter[] { new SqlParameter("@dd", dd), new SqlParameter("@dd2", dd) }, CommandType.StoredProcedure); foreach (DataRow item in dt2.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.ROOM_NUMBER = item["ROOM_NUMBER"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = (item["INDIVIDUAL_ID"]) == DBNull.Value?-1:Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ATRIBUTE = (item["SPECIALIS_ID"].ToString() != Lg.ToString() || item["LOG_IN_ID"].ToString() == null) ? "NotC" : "Curr"; r.DELIVERY_TYPE_ID = 1; r.ADRESS = item["OBJECT_ADRESS"].ToString(); r.COMMENT_FILE = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (item["ORDER"].ToString() == "1") ? true : false;//(item["EMERGENCY_TREATMENT"].ToString().Length==0)?false: (bool)item["EMERGENCY_TREATMENT"]; r.MOBILE_NUMBER = item["MOBILE_NUMBER"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string gtRstTable(int LogId) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("requestTable", new SqlParameter[] { new SqlParameter("@lg", LogId) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.CR_DATE = item["CR_DATE"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); r.REQUEST_COMMENT = item["REQUEST_COMMENT"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ACCOUNT_NAME = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string AFiltering2(int lg, int dd, List <Kvorum_App.Disp_Admin.Utilities.Filter> flt) { string REQUEST_ID = ""; string ROOM_NUMBER = ""; string OBJECT_ID = ""; string ROOM_TYPE_ID = ""; string FIRST_NAME = ""; string STATUS_ID = ""; string CR_DATE_from = ""; string CR_DATEE_TO = ""; foreach (Kvorum_App.Disp_Admin.Utilities.Filter item in flt) { REQUEST_ID = (item.REQUEST_ID != 0) ? item.REQUEST_ID.ToString() : null; ROOM_NUMBER = (item.ROOM_NUMBER != "0") ? item.ROOM_NUMBER.ToString() : null; //ROOM_NUMBER = (ROOM_NUMBER != "") ? ROOM_NUMBER.Replace("q", "'").Replace("w", "\"").Replace("L", ":") : ""; //ROOM_NUMBER = (item.ROOM_NUMBER != 0) ? "REQUEST_COMMENT like \'%\"room\":\"" + item.ROOM_NUMBER.ToString() + "\"%\'" : ""; OBJECT_ID = (item.OBJECT_ID != 0) ? item.OBJECT_ID.ToString() : null; //OBJECT_ID = (OBJECT_ID != "") ? OBJECT_ID.Replace("q", "'").Replace("z", "\"").Replace("w", ":") : ""; ROOM_TYPE_ID = (item.ROOM_TYPE_ID != 0) ? item.ROOM_TYPE_ID.ToString() : null; FIRST_NAME = (item.FIRST_NAME != "") ? item.FIRST_NAME : null; //FIRST_NAME = (FIRST_NAME != "") ? FIRST_NAME.Replace("q", "'").Replace("w", "\"").Replace("L", ":") : ""; STATUS_ID = (item.STATUSE != 0) ? item.STATUSE.ToString() : null; CR_DATE_from = (item.CR_DATE_FROM != "") ? item.CR_DATE_FROM : null; //CR_DATE_from = (CR_DATE_from != "") ? CR_DATE_from.Replace("\"", "'") : ""; CR_DATEE_TO = (item.CR_DATE_TO != "") ? item.CR_DATE_TO : null; //CR_DATEE_TO = (CR_DATEE_TO != "") ? CR_DATEE_TO.Replace("\"", "'") : ""; } System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_AllFilterin2", new SqlParameter[] { new SqlParameter("@rid", REQUEST_ID), new SqlParameter("@dd", dd), new SqlParameter("@Cr_S", CR_DATE_from), new SqlParameter("@Cr_E", CR_DATEE_TO), new SqlParameter("@R_ObjId", OBJECT_ID), new SqlParameter("@R_Room", ROOM_NUMBER), new SqlParameter("@R_indName", FIRST_NAME), new SqlParameter("@StatusId", STATUS_ID), new SqlParameter("@rt", ROOM_TYPE_ID) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); r.REQUEST_COMMENT = item["REQUEST_COMMENT"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ATRIBUTE = (Convert.ToInt32(item["LOG_IN_ID"]) == lg) ? "Curr" : "NotC"; r.COMMENT_FILE = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string AFiltering(int lg, int dd, List <Kvorum_App.Disp_Admin.Utilities.Filter> flt) { string MOBILE_NUMBER = ""; string ROOM_NUMBER = ""; string OBJECT_ID = ""; string ROOM_TYPE_ID = ""; string FIRST_NAME = ""; string STATUS_ID = ""; string CR_DATE_from = ""; string CR_DATEE_TO = ""; foreach (Kvorum_App.Disp_Admin.Utilities.Filter item in flt) { MOBILE_NUMBER = (item.MOBILE_NUMBER.Length != 0) ? item.MOBILE_NUMBER.ToString() : null; ROOM_NUMBER = (item.ROOM_NUMBER != "0") ? item.ROOM_NUMBER.ToString() : null; OBJECT_ID = (item.OBJECT_ID != 0) ? item.OBJECT_ID.ToString() : null; ROOM_TYPE_ID = (item.ROOM_TYPE_ID != 0) ? item.ROOM_TYPE_ID.ToString() : null; FIRST_NAME = (item.FIRST_NAME != "") ? item.FIRST_NAME : null; // FIRST_NAME = (FIRST_NAME != "") ? FIRST_NAME.Replace("\"", "'"):""; STATUS_ID = (item.STATUSE != 0) ? item.STATUSE.ToString() : null; CR_DATE_from = (item.CR_DATE_FROM != "") ? item.CR_DATE_FROM : null; //CR_DATE_from = (CR_DATE_from != "") ? CR_DATE_from.Replace("\"", "'"):""; CR_DATEE_TO = (item.CR_DATE_TO != "") ? item.CR_DATE_TO : null; //CR_DATEE_TO = (CR_DATEE_TO != "") ? CR_DATEE_TO.Replace("\"", "'"):""; } System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_AllFilterin", new SqlParameter[] { new SqlParameter("@rid", MOBILE_NUMBER), new SqlParameter("@room", ROOM_NUMBER), new SqlParameter("@objectId", OBJECT_ID), new SqlParameter("@roomtype", ROOM_TYPE_ID), new SqlParameter("@firstname", FIRST_NAME), new SqlParameter("@status", STATUS_ID), new SqlParameter("@cr_S", CR_DATE_from), new SqlParameter("@cr_E", CR_DATEE_TO), new SqlParameter("@dd", dd) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.ROOM_NUMBER = item["ROOM_NUMBER"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.ATRIBUTE = (item["LOG_IN_ID"].ToString() != lg.ToString() || item["LOG_IN_ID"].ToString() == null) ? "NotC" : "Curr"; r.DELIVERY_TYPE_ID = 1; r.ADRESS = item["OBJECT_ADRESS"].ToString(); r.COMMENT_FILE = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (item["EMERGENCY_TREATMENT"].ToString().Length == 0) ? false : (bool)item["EMERGENCY_TREATMENT"]; r.MOBILE_NUMBER = item["MOBILE_NUMBER"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rs)); }
public static string AFilterin(List <Kvorum_App.Disp_Admin.Utilities.Filter> flt, int Log) { string returnval = ""; /*string r ="REQUEST_ID=5"; * Console.WriteLine(r); * int index = r.IndexOf('.'); * r=r.Substring(r.LastIndexOf('=')+1); * Console.WriteLine(r);*/ string REQUEST_ID = ""; string ROOM_NUMBER = ""; string OBJECT_ID = ""; string ROOM_TYPE_ID = ""; string FIRST_NAME = ""; string STATUS_ID = ""; string CR_DATE_from = ""; string CR_DATEE_TO = ""; foreach (Kvorum_App.Disp_Admin.Utilities.Filter item in flt) { REQUEST_ID = (item.REQUEST_ID != 0) ? "REQUEST_ID=" + item.REQUEST_ID.ToString() : ""; ROOM_NUMBER = (item.ROOM_NUMBER != "0") ? "ROOM_NUMBER =" + item.ROOM_NUMBER.ToString() + "" : ""; OBJECT_ID = (item.OBJECT_ID != 0) ? "OBJECT_ID=" + item.OBJECT_ID.ToString() + "" : ""; ROOM_TYPE_ID = (item.ROOM_TYPE_ID != 0) ? "ROOM_TYPE_ID=" + item.ROOM_TYPE_ID.ToString() + "" : ""; FIRST_NAME = (item.FIRST_NAME != "") ? string.Format("FIRST_NAME=\"{0}\"", item.FIRST_NAME) : ""; FIRST_NAME = (FIRST_NAME != "") ? FIRST_NAME.Replace("\"", "'") : ""; STATUS_ID = (item.STATUSE != 0) ? "STATUS_ID=" + item.STATUSE.ToString() : ""; CR_DATE_from = (item.CR_DATE_FROM != "") ? string.Format("CR_DATE >=\"{0}\"", item.CR_DATE_FROM) : ""; CR_DATE_from = (CR_DATE_from != "") ? CR_DATE_from.Replace("\"", "'") : ""; CR_DATEE_TO = (item.CR_DATE_TO != "") ? string.Format("CR_DATE<=\"{0}\"", item.CR_DATE_TO) : ""; CR_DATEE_TO = (CR_DATEE_TO != "") ? CR_DATEE_TO.Replace("\"", "'") : ""; } string CLiD = Mydb.ExecuteScalar("select CLIENT_ID from VW_ALL_REQUESTS where LOG_IN_ID=@lg", new SqlParameter[] { new SqlParameter("@lg", Log) }, CommandType.Text).ToString(); string query = "select * from VW_ALL_REQUESTS where CLIENT_ID=" + CLiD + " " + ((REQUEST_ID != "") ? " and " + REQUEST_ID : " ") + " " + ((STATUS_ID != "") ? " and " + STATUS_ID : " ") + " " + ((CR_DATE_from != "") ? " and " + CR_DATE_from : " ") + " " + ((CR_DATEE_TO != "") ? " and " + CR_DATEE_TO : " ") + " " + ((ROOM_NUMBER != "") ? " and " + ROOM_NUMBER : " ") + " " + ((OBJECT_ID != "") ? " and " + OBJECT_ID : " ") + " " + ((ROOM_TYPE_ID != "") ? " and " + ROOM_TYPE_ID : " ") + " " + ((FIRST_NAME != "") ? " and " + FIRST_NAME : " "); System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable(query, new SqlParameter[] { }, CommandType.Text); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.COMMENT_FILE = (Convert.ToInt32(item["LOG_IN_ID"]) == Log) ? "Curr" : "NoC"; rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); returnval = js.Serialize(rs); return(returnval); }
public static string Filterin(List <Kvorum_App.Disp_Admin.Utilities.Filter> flt, int Log) { string returnval = ""; /*string r ="REQUEST_ID=5"; * Console.WriteLine(r); * int index = r.IndexOf('.'); * r=r.Substring(r.LastIndexOf('=')+1); * Console.WriteLine(r);*/ string MOBILE_NUMBER = ""; string ROOM_NUMBER = ""; string OBJECT_ID = ""; string ROOM_TYPE_ID = ""; string FIRST_NAME = ""; string STATUS_ID = ""; string CR_DATE_from = ""; string CR_DATEE_TO = ""; foreach (Kvorum_App.Disp_Admin.Utilities.Filter item in flt) { MOBILE_NUMBER = (item.MOBILE_NUMBER.Length != 0) ? item.MOBILE_NUMBER.ToString() : null; ROOM_NUMBER = (item.ROOM_NUMBER != "0") ? item.ROOM_NUMBER.ToString() :null; OBJECT_ID = (item.OBJECT_ID != 0) ? item.OBJECT_ID.ToString() : null; ROOM_TYPE_ID = (item.ROOM_TYPE_ID != 0) ? item.ROOM_TYPE_ID.ToString() : null; FIRST_NAME = (item.FIRST_NAME != "") ? item.FIRST_NAME: null; // FIRST_NAME = (FIRST_NAME != "") ? FIRST_NAME.Replace("\"", "'"):""; STATUS_ID = (item.STATUSE != 0) ? item.STATUSE.ToString() : null; CR_DATE_from = (item.CR_DATE_FROM != "") ? item.CR_DATE_FROM: null; //CR_DATE_from = (CR_DATE_from != "") ? CR_DATE_from.Replace("\"", "'"):""; CR_DATEE_TO = (item.CR_DATE_TO != "") ? item.CR_DATE_TO: null; //CR_DATEE_TO = (CR_DATEE_TO != "") ? CR_DATEE_TO.Replace("\"", "'"):""; } //string query = "select * from VW_Request_Datas where LOG_IN_ID=" + Log+" " +( (REQUEST_ID != "") ? " and " + REQUEST_ID : " ") + " " +((STATUS_ID != "") ? " and " + STATUS_ID : " ") + " " + ((CR_DATE_from != "") ? " and " + CR_DATE_from : " ") + " " + ((CR_DATEE_TO != "") ? " and " + CR_DATEE_TO : " ") + " " + ((ROOM_NUMBER != "") ? " and " + ROOM_NUMBER : " ") + " " + ((OBJECT_ID != "") ? " and " + OBJECT_ID : " ") + " " + ((ROOM_TYPE_ID != "") ? " and " + ROOM_TYPE_ID : " ") + " " + ((FIRST_NAME != "") ? " and " + FIRST_NAME : " "); System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_Filtering", new SqlParameter[] { new SqlParameter("@rid", MOBILE_NUMBER), new SqlParameter("@room", ROOM_NUMBER), new SqlParameter("@objectId", OBJECT_ID), new SqlParameter("@roomtype", ROOM_TYPE_ID), new SqlParameter("@firstname", FIRST_NAME), new SqlParameter("@status", STATUS_ID), new SqlParameter("@cr_S", CR_DATE_from), new SqlParameter("@cr_E", CR_DATEE_TO), new SqlParameter("@lg", Log) }, CommandType.StoredProcedure); List <Request> rs = new List <Utilities.Request>(); foreach (DataRow item in dt.Rows) { Request r = new Utilities.Request(); r.ACCOUNT_NAME = item["ACCOUNT_NAME"].ToString(); r.ROOM_TYPE = item["ROOM_TYPE"].ToString(); r.CR_DATE = item["CR_DATE"].ToString(); r.REQUEST_ID = Convert.ToInt32(item["REQUEST_ID"]); r.REQUEST_TEXT = item["REQUEST_TEXT"].ToString(); // r.SERVICE_NAME = item["SERVICE_NAME"].ToString(); r.STATUS = item["STATUS"].ToString(); r.PLAN_END_DATE = item["PLAN_END_DATE"].ToString(); r.INDIVIDUAL_ID = Convert.ToInt32(item["INDIVIDUAL_ID"]); r.FIRST_NAME = item["FIRST_NAME"].ToString(); r.STATUS_ID = item["STATUS_ID"].ToString(); r.REQUEST_COMMENT = item["PAYMENT"].ToString(); r.EMERGENCY_TREATMENT = (bool)item["EMERGENCY_TREATMENT"]; r.ADRESS = item["OBJECT_ADRESS"].ToString(); r.MOBILE_NUMBER = item["MOBILE_NUMBER"].ToString(); rs.Add(r); } JavaScriptSerializer js = new JavaScriptSerializer(); returnval = js.Serialize(rs); return(returnval); }