public static string AddInfo(int McId, List <DOC_FOR_MC> dc) { foreach (DOC_FOR_MC item in dc) { if (item.KAT_ID != 0) { int CounOfDoc = (int)Mydb.ExecuteScalar("select COUNT(*) from DOC_FOR_MC where D_URL=@url and MC_ID=@mc", new SqlParameter[] { new SqlParameter("@url", item.D_URL), new SqlParameter("@mc", McId) }, CommandType.Text); if (CounOfDoc == 0) { // Mydb.ExecuteNoNQuery("delete from DOC_FOR_MC where MC_ID=@mc", new SqlParameter[] { new SqlParameter("@mc", McId) }, CommandType.Text); Mydb.ExecuteNoNQuery("insert into DOC_FOR_MC (D_NAME,D_URL,KAT_ID,MC_ID) values (@dnm,@durl,@kid,@mc)", new SqlParameter[] { new SqlParameter("@dnm", item.D_NAME), new SqlParameter("@durl", item.D_URL), new SqlParameter("@kid", item.KAT_ID), new SqlParameter("@mc", McId) }, CommandType.Text); } } //else //{ // Mydb.ExecuteNoNQuery("delete from DOC_FOR_MC where MC_ID=@mc", new SqlParameter[] { new SqlParameter("@mc", McId) }, CommandType.Text); //} } //foreach (DOC_FOR_MC item in dcRemove) //{ //if (item.D_NAME=="Udal") //{ // Mydb.ExecuteNoNQuery("delete from DOC_FOR_MC where D_URL=@d", new SqlParameter[] { new SqlParameter("@d", item.D_URL) }, CommandType.Text); //} //} return(""); }
private void GenerateQrCode(string guid) { string json = new JavaScriptSerializer().Serialize(new { QRTEXT = guid, }); string url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + "/WCFServices/MATORIN.QUICK_API.svc/CreateQRCode"; //"http://172.20.20.115/WCFServices/MATORIN.QUICK_API.svc/CreateQRCode";// // HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/json"; request.ContentLength = json.Length; using (var writer = new StreamWriter(request.GetRequestStream())) { writer.Write(json); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); var dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); JavaScriptSerializer js = new JavaScriptSerializer(); var obj = js.Deserialize <dynamic>(responseFromServer); var ResultData = obj["ResultData"]; var QR_CODE = ResultData["QR_CODE_URL"]; Mydb.ExecuteNoNQuery("Update_ROOM_QRCODE", new SqlParameter[] { new SqlParameter("@room_guid", guid), new SqlParameter("@QRCODE", QR_CODE) }, CommandType.StoredProcedure); }
public static string GetCountersT(string s) { int o = (int)Mydb.ExecuteScalar("select top 1 OBJECT_ID from VW_ROOMS where NUMBER=@s", new SqlParameter[] { new SqlParameter("@s", s) }, CommandType.Text); DataTable dt = Mydb.ExecuteReadertoDataTable("select * from VW_METERS where OBJECT_ID=@o and ROOM_NUMBER=(select ROOM_ID from PER_SCORE where SCORE_ID=@s)", new SqlParameter[] { new SqlParameter("@o", o), new SqlParameter("@s", s) }, CommandType.Text); List <METERS> ms = new List <METERS>(); foreach (DataRow item in dt.Rows) { METERS m = new METERS(); m.AMUNT_TARIF = item["AMUNT_TARIF"].ToString(); m.LOG_IN_ID = item["LOG_IN_ID"].ToString(); m.METERS_ID = item["METERS_ID"].ToString(); m.METERS_NUMBER = item["METERS_NUMBER"].ToString(); m.NEXT_DATE = item["NEXT_DATE"].ToString(); m.OBJECT_ID = item["OBJECT_ID"].ToString(); m.PREVIOUS_DATE = item["PREVIOUS_DATE"].ToString(); m.ROOM_NUMBER = item["ROOM_NUMBER"].ToString(); m.ROOM_TYPE = item["ROOM_TYPE"].ToString(); m.ROOM_TYPE_ID = item["ROOM_TYPE_ID"].ToString(); m.SCORE_ID = item["SCORE_ID"].ToString(); m.TYPE = item["TYPE"].ToString(); m.TYPE_ID = item["TYPE"].ToString(); ms.Add(m); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(ms)); }
public static string getTenantDatas(string score) { string result = ""; DataTable dtObj = Mydb.ExecuteReadertoDataTable("SELECT OBJECT_ADRESS,OBJECT_ID FROM OBJECT WHERE OBJECT_ID=(select OBJECT_ID from ROOM where ROOM_ID =(select ROOM_ID from PER_SCORE where IS_DELETED=0 and SCORE_ID=@s))", new SqlParameter[] { new SqlParameter("@s", score) }, CommandType.Text); List <ObjectS> os = new List <ObjectS>(); foreach (DataRow item in dtObj.Rows) { ObjectS o = new ObjectS(); o.ObjectAdress = item["OBJECT_ADRESS"].ToString(); o.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); os.Add(o); } JavaScriptSerializer jsObj = new JavaScriptSerializer(); DataTable dt = Mydb.ExecuteReadertoDataTable("select * from IND_NAME where INDIVIDUAL_ID in (select INDIVIDUAL_ID from INDIVIDUAL_PERSCORE where SCORE_ID=@s)", new SqlParameter[] { new SqlParameter("@s", score) }, CommandType.Text); List <AccountDatas> ads = new List <AccountDatas>(); foreach (DataRow item in dt.Rows) { AccountDatas ad = new AccountDatas(); ad.FIRST_NAME = item["FIRST_NAME"].ToString(); ad.PHONE = item["PHONE"].ToString(); ad.SHARE = item["INDIVIDUAL_ID"].ToString(); ads.Add(ad); } JavaScriptSerializer jsad = new JavaScriptSerializer(); result = "{\"result\" : \"Ok\",\"ADatas\":" + jsad.Serialize(ads) + ",\"ObjDatas\":" + jsObj.Serialize(os) + "}"; return(result); }
protected void Page_Load(object sender, EventArgs e) { string url = HttpContext.Current.Request.Url.AbsoluteUri; string decodedUrl = HttpUtility.UrlDecode(url); var uri = new Uri(url); var query = HttpUtility.ParseQueryString(uri.Query); string obj = query.Get("obj"); string lg = query.Get("lg"); string roomId = query.Get("roomId"); string types_param = query.Get("types"); byte[] bytes = Convert.FromBase64String(types_param); var types = Encoding.ASCII.GetString(bytes); dynamic RoomTypes = JsonConvert.DeserializeObject(types); foreach (var item in RoomTypes) { dynamic QRS_AND_Adress = JsonConvert.DeserializeObject(Mydb.ExecuteAsJson("Get_QRS_AND_Adress", new SqlParameter[] { new SqlParameter("@lg", Convert.ToInt32(lg)), new SqlParameter("@types", Convert.ToInt32(item.ROOM_TYPE)), new SqlParameter("@obj", Convert.ToInt32(obj)), new SqlParameter("@roomId", Convert.ToInt32(roomId)) }, CommandType.StoredProcedure)); foreach (var item2 in QRS_AND_Adress) { string Guid = item2.ROOM_GUID; //HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + string path = @"C:\inetpub\wwwroot\__QR\" + Guid.Trim() + ".jpg"; if (!File.Exists(path)) { GenerateQrCode(Guid); } string QR_CODE = item2.QR_CODES; string Adress = item2.OBJECT_ADRESS; Response.Write("<div class=\"tabService\"><img src=\"" + QR_CODE + "\" class=\"qr\"><div class=\"headerServ\">" + Adress + "</div></div>"); } } }
public static string GetStreetsBytext(string txt, string score) { DataTable dt = null; if (score == "0") { dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID,OBJECT_ADRESS from OBJECT where OBJECT_ADRESS like '%'+@txt+'%'", new SqlParameter[] { new SqlParameter("@txt", txt) }, CommandType.Text); } else { dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID,OBJECT_ADRESS from OBJECT where OBJECT_ID=(select OBJECT_ID from PER_SCORE where SCORE_ID=@score)", new SqlParameter[] { new SqlParameter("@score", score) }, CommandType.Text); } List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string LoginIdentity(string Id_, string isTenant, string role) { string returnvalue = null; try { if (isTenant == "false") { /* * Mydb.ExecuteScalar("LoginIdendity", new SqlParameter[] { new SqlParameter("@procType", "2"), new SqlParameter("@lg", Id) }, CommandType.StoredProcedure);*/ if (role != "УК") { returnvalue = UK_Login(Id_); } else { int CountOfMailAsClient = Convert.ToInt32(Mydb.ExecuteScalar("LoginIdendity", new SqlParameter[] { new SqlParameter("@procType", "6"), new SqlParameter("@mail", Id_) }, CommandType.StoredProcedure)); if (CountOfMailAsClient == 0) { Mydb.ExecuteNoNQuery("InsertNewClient_T", new SqlParameter[] { new SqlParameter("@mail", Id_) }, CommandType.StoredProcedure); returnvalue = UK_Login(Id_); } else { returnvalue = UK_Login(Id_); } } } else if (isTenant == "true") { //Mydb.ExecuteAsJson("LoginSecond", new SqlParameter[] { new SqlParameter("@sc", Id_), new SqlParameter("@pass", pass) }, CommandType.StoredProcedure) returnvalue = Mydb.ExecuteAsJson("TestDB.dbo.sp_QUICK_API_get_accounts_by_device1", new SqlParameter[] { new SqlParameter("@device_id", Id_) }, CommandType.StoredProcedure); } } catch (Exception ex) { returnvalue = "{\"result\" : \"ErrorIdendity\"}"; } /* * return Redirect(AppConstants.AuthServer() + "/connect/endsession?id_token_hint=" + idToken + "&post_logout_redirect_uri=" + AppConstants.ClientServer() + "/signout-callback-oidc"); */ //HttpContext.Current.Response.Redirect("https://upravbot.ru/IDS4/Account/Logout?logoutId=CfDJ8JQq6V4gQ1xPva8MeQadqxUh3pMtraOr8jUvW3qBRzq9wjZC_7fNFZKIYrQJb94_dXsQJdLY64yybb8ZktHoTlmfzsLBfLLKRHIAuq7no_fY4fV35KwYxS6yGoQ10iGckHDmBjHS6pJcM8SwTA141e9htZFEwmiA1BQ9klespO6JcD4xZLTWbHbKm9N0juHicGdGySaC0TS5WQBsdJ3CxhDQeAt9lmcNZLTlv-2zOS8aX1bnW3p_UkLyOOszvEij3SsQSdcxo4GzSMW6UJ5ZhVBO9PizBVpxKTgKf-0ntb1_EMTxBC20xBY1h_foAP_vjsAyt2a8mEFSxRdZRcjiBIM"); //HttpContext.Current.Response.Cookies.Remove("cookie"); //HttpContext.Current.Response.Cookies["cookie"].Expires = DateTime.Now.AddDays(-1); //HttpContext.Current.GetOwinContext().Authentication.SignOut("Cookies"); //HttpContext.Current.GetOwinContext().Authentication.SignOut("oidc"); //HttpContext.Current.GetOwinContext().Authentication.SignOut(); // HttpContext.Current.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType); // examplefunction(); return(returnvalue); }
public static string MakeZakrit(int rid, string rst, string sm) { Mydb.ExecuteNoNQuery("update REQUEST set STATUS_ID=5 where REQUEST_ID=@rid", new SqlParameter[] { new SqlParameter("@rid", rid) }, CommandType.Text); Mydb.ExecuteNoNQuery("insert into REQUEST_STATUS_TEXT (RS_TEXT,RS_SMILE) values (@rst,@rsm)", new SqlParameter[] { new SqlParameter("@rst", rst), new SqlParameter("@rsm", sm) }, CommandType.Text); int LastId = (int)Mydb.ExecuteScalar(" select top 1 RST_ID from REQUEST_STATUS_TEXT order by RST_ID desc", new SqlParameter[] { }, CommandType.Text); Mydb.ExecuteNoNQuery("insert into REQUEST_STATUS_FILE (REQUEST_ID,FILE_ADRESS,RST_ID)values (@r_id,@fs,@rst)", new SqlParameter[] { new SqlParameter("@r_id", rid), new SqlParameter("@fs", "0"), new SqlParameter("@rst", LastId) }, CommandType.Text); return("{\"result\" : \"ok\"}"); }
public static string SendMail(string mailto, string subject, string body) { string returnvalue = null; try { Mydb.ExecuteNoNQuery("sp_Send_Mail_Upravbot", new SqlParameter[] { new SqlParameter("@mailto", mailto), new SqlParameter("@theme", subject), new SqlParameter("@body", body) }, CommandType.StoredProcedure); returnvalue = ""; } catch (Exception) { throw; } return(returnvalue); }
public static string CheckRmNum(int ObjId) { int rmNum = (int)Mydb.ExecuteScalar("select count(ROOM_NUMBER) from Room where OBJECT_ID=@ObjId", new SqlParameter[] { new SqlParameter("@ObjId", ObjId) }, CommandType.Text); string result = ""; if (rmNum != 0) { result = "{\"result\" : \"" + rmNum + "\"}"; } else { result = "{\"result\" : \"0\"}"; } return(result); }
public static string SecondLogin(string score, string Pass) { string result = ""; string msPass = (string)Mydb.ExecuteScalar("select PASS from PER_SCORE where SCORE_ID=@s", new SqlParameter[] { new SqlParameter("@s", score) }, CommandType.Text); if (msPass == Pass) { result = "{\"result\" : \"0\"}"; } else { result = "{\"result\" : \"1\"}"; } return(result); }
public static string getServiceType() { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from SERVICE_TYPE where IS_DELETED=0", new SqlParameter[] { }, CommandType.Text); List <RequestTenant> rts = new List <RequestTenant>(); foreach (DataRow item in dt.Rows) { RequestTenant rt = new RequestTenant(); rt.ACCOUNT_NAME = item["SERVICE_TYPE_NAME"].ToString(); rt.NUMBER = item["SERVICE_TYPE_ID"].ToString(); rts.Add(rt); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rts)); }
public static string CheckPers(string pers) { int Count = (int)Mydb.ExecuteScalar("select COUNT(*) from PER_SCORE where NUMBER=@pers", new SqlParameter[] { new SqlParameter("@pers", pers) }, CommandType.Text); string result = ""; if (Count == 0) { result = "{\"result\" : \"0\"}"; } else { result = "{\"result\" : \"1\"}"; } return(result); }
public static string getObjectId(string adr) { string Result = ""; int count = (int)Mydb.ExecuteScalar("select count (*) from OBJECT where OBJECT_ADRESS=@adr", new SqlParameter[] { new SqlParameter("@adr", adr) }, CommandType.Text); if (count != 0) { string ObjId = Mydb.ExecuteScalar("select OBJECT_ID from OBJECT where OBJECT_ADRESS=@adr", new SqlParameter[] { new SqlParameter("@adr", adr) }, CommandType.Text).ToString(); Result = "{\"result\" : \"" + ObjId + "\"}"; } else { Result = "{\"result\" : \"0\"}"; } return(Result); }
public static string getStatuses(string Score) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("select * from REQUEST_STATUS", new SqlParameter[] { }, CommandType.Text); List <REQUEST_STATUS> rss = new List <REQUEST_STATUS>(); foreach (DataRow item in dt.Rows) { REQUEST_STATUS rs = new REQUEST_STATUS(); rs.STATUS = item["STATUS"].ToString(); rs.STATUS_ID = item["STATUS_ID"].ToString(); rss.Add(rs); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rss)); }
public static string Makefilter(List <TenantRFilter> flt, string score) { try { string STATUS_ID = null; string SERVICE_TYPE_ID = null; string REQUEST_ID = null; string Cr_S = null; string Cr_E = null; foreach (TenantRFilter item in flt) { STATUS_ID = (item.STATUS_ID.ToString() != "0") ? item.STATUS_ID.ToString() : null; SERVICE_TYPE_ID = (item.SERVICE_TYPE_ID == "0") ? null : item.SERVICE_TYPE_ID; REQUEST_ID = (item.REQUEST_ID == "") ? null : item.REQUEST_ID; Cr_E = (item.Cr_E == "") ? null : item.Cr_E; Cr_S = (item.Cr_S == "") ? null : item.Cr_S; } DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_TenantRFiltering", new SqlParameter[] { new SqlParameter("@score", score), new SqlParameter("@STATUS_ID", STATUS_ID), new SqlParameter("@SERVICE_TYPE_ID", SERVICE_TYPE_ID), new SqlParameter("@REQUEST_ID", REQUEST_ID), new SqlParameter("@Cr_S", Cr_S), new SqlParameter("@Cr_E", Cr_E) }, CommandType.StoredProcedure); List <RequestTenant> rts = new List <RequestTenant>(); foreach (DataRow item in dt.Rows) { RequestTenant rt = new RequestTenant(); rt.FIRST_NAME = item["FIRST_NAME"].ToString(); rt.ROOM_T = item["REQUEST_ID"].ToString(); rt.ACCOUNT_NAME = item["CR_DATE"].ToString(); rt.ROOM_NUMBER = item["STATUS"].ToString(); rt.PHONE = item["STATUS_ID"].ToString(); rt.INDIVIDUAL_ID = item["DONE_DATE"].ToString(); rts.Add(rt); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rts)); } catch (Exception ex) { return("{\"result\" : \"" + ex.ToString() + "\"}"); } }
public static string ChangePass_(int Id, string Pass) { Pass = GetMd5HashData(Pass); Mydb.ExecuteNoNQuery("update ACCOUNT set PASSWORD=@p where CLIENT_ID=@id and LOGIN is null", new SqlParameter[] { new SqlParameter("@p", Pass), new SqlParameter("@id", Id) }, CommandType.Text); int LogId = (int)Mydb.ExecuteScalar("select LOG_IN_ID from ACCOUNT where CLIENT_ID=@c", new SqlParameter[] { new SqlParameter("@c", Id) }, CommandType.Text); Mydb.ExecuteNoNQuery("update CLIENT set GUID=NEWID() where CLIENT_ID=@Id", new SqlParameter[] { new SqlParameter("@Id", Id) }, CommandType.Text); Mydb.ExecuteNoNQuery("usp_ConstructorAPI_INSERT_LOG", new SqlParameter[] { new SqlParameter("@EVENT_TYPE", "Восстановление пароля"), new SqlParameter("@EVENT_STATUS", "Систем"), new SqlParameter("@EVENT_ROLE", "Администратор"), new SqlParameter("@EVENT_MODULE", "Клиентское администрирование"), new SqlParameter("@EVENT_MESSAGE", "Пользователь запросил (" + LogId + ") Восстановление пароля"), new SqlParameter("@EVENT_MAKER", LogId) }, CommandType.StoredProcedure); return("{\"result\" : \"1\"}"); }
public static string getInfos(int McId) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from DOC_FOR_MC where MC_ID=@id", new SqlParameter[] { new SqlParameter("@id", McId) }, CommandType.Text); List <DOC_FOR_MC> ds = new List <DOC_FOR_MC>(); foreach (DataRow item in dt.Rows) { DOC_FOR_MC d = new DOC_FOR_MC(); d.D_NAME = item["D_NAME"].ToString(); d.D_URL = item["D_URL"].ToString(); d.KAT_ID = Convert.ToInt32(item["KAT_ID"]); ds.Add(d); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(ds)); }
public static string ControlAndSave(string mail, int TipOrg, string Pass) { try { int countOfmail = (int)Mydb.ExecuteScalar("select COUNT(*) from ACCOUNT where E_MAIL =@mail", new SqlParameter[] { new SqlParameter("@mail", mail) }, CommandType.Text); if (countOfmail == 0) { Mydb.ExecuteNoNQuery("insert into CLIENT (ATTRIBUTE_ID,VERIFICATION_) values(@ID,@verf)", new SqlParameter[] { new SqlParameter("@ID", TipOrg), new SqlParameter("@verf", false) }, CommandType.Text); int LastClientId = (int)Mydb.ExecuteScalar("SELECT TOP 1 CLIENT_ID FROM CLIENT ORDER BY CLIENT_ID DESC", new SqlParameter[] { }, CommandType.Text); Mydb.ExecuteNoNQuery("insert into ACCOUNT(E_MAIL,PASSWORD,CLIENT_ID) values(@mail,@pass,@Cl_ID)", new SqlParameter[] { new SqlParameter("@mail", mail), new SqlParameter("@pass", GetMd5HashData(Pass)), new SqlParameter("@Cl_ID", LastClientId) }, CommandType.Text); string guid = Mydb.ExecuteScalar("select GUID from CLIENT where CLIENT_ID=(select CLIENT_ID from ACCOUNT where E_MAIL=@EmailC)", new SqlParameter[] { new SqlParameter("@EmailC", mail) }, CommandType.Text).ToString(); string CLient = Mydb.ExecuteScalar("select CLIENT_ID from ACCOUNT where E_MAIL=@mailC", new SqlParameter[] { new SqlParameter("@mailC", mail) }, CommandType.Text).ToString(); string LogId = Mydb.ExecuteScalar("select LOG_IN_ID from ACCOUNT where E_MAIL=@mailC", new SqlParameter[] { new SqlParameter("@mailC", mail) }, CommandType.Text).ToString(); //string RolName = "Нечего"; //string ModulName = "Нечего"; //if (role == "4") //{ // ModulName = "Клиентское администрирование"; // RolName = "Администратор"; //} //if (role == "3") //{ // ModulName = "Диспетчерская"; // RolName = "Диспетчер"; //} Mydb.ExecuteNoNQuery("usp_ConstructorAPI_INSERT_LOG", new SqlParameter[] { new SqlParameter("@EVENT_TYPE", "Регистрация"), new SqlParameter("@EVENT_STATUS", "Систем"), new SqlParameter("@EVENT_ROLE", "Администратор"), new SqlParameter("@EVENT_MODULE", "Клиентское администрирование"), new SqlParameter("@EVENT_MESSAGE", "Зарегистрирован новый пользователь (email: " + mail + ")"), new SqlParameter("@EVENT_MAKER", LogId) }, CommandType.StoredProcedure); return("{\"result\" : \"2\",\"guid\" : \"" + guid + "\",\"Id\" : \"" + CLient + "\",\"logId\":\"" + LogId + "\"}"); } else { return("{\"result\" : \"1\"}"); } } catch (Exception e) { return("{\" ERROR\" : \"" + e.Message.ToString() + "\"}"); } }
protected void Page_Load(object sender, EventArgs e) { int Id = Convert.ToInt32(Request.QueryString["Id"]); string g_url = Request.QueryString["g"]; if (g_url != null) { string g_client = Mydb.ExecuteScalar("select GUID from CLIENT where CLIENT_ID=@Id", new SqlParameter[] { new SqlParameter("@Id", Id) }, CommandType.Text).ToString(); if (g_client != g_url) { Response.Redirect("Client_Admin/AlertingError.aspx?reason=g&chp=notC"); } else { //Mydb.ExecuteNoNQuery("update CLIENT set VERIFICATION_=1 where CLIENT_ID=@Id", new SqlParameter[] { new SqlParameter("@Id", Id) }, CommandType.Text); } } }
public static string Logtenant(string Score, int ObjId, string Room_Num, string PassT) { string result = ""; //DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_TenantLogin", new SqlParameter[] {new SqlParameter("@Score",Score),new SqlParameter("@ObjId", ObjId),new SqlParameter("@Room_Num", Room_Num) }, CommandType.StoredProcedure); //foreach (DataRow item in dt.Rows) //{ // result= "{\"result\" : \"" + item["Result"] + "\"}"; //} int RoomCount = (int)Mydb.ExecuteScalar("select COUNT (*) from ROOM where ROOM_NUMBER=@Room_Num and ROOM_ID=(select ROOM_ID from PER_SCORE where SCORE_ID=@Score and OBJECT_ID=@ObjId)", new SqlParameter[] { new SqlParameter("@Room_Num", Room_Num), new SqlParameter("@Score", Score), new SqlParameter("@ObjId", ObjId) }, CommandType.Text); if (RoomCount != 0) { int PassCount = (int)Mydb.ExecuteScalar("select COUNT(*) from PER_SCORE where PASS=@PassT and SCORE_ID=@Score and OBJECT_ID=@ObjId and ROOM_ID=(select ROOM_ID from ROOM where ROOM_NUMBER=@Room_Num and OBJECT_ID=@obj_Id)", new SqlParameter[] { new SqlParameter("@PassT", PassT), new SqlParameter("@Score", Score), new SqlParameter("@ObjId", ObjId), new SqlParameter("@Room_Num", Room_Num), new SqlParameter("@obj_Id", ObjId) }, CommandType.Text); if (PassCount == 1) { int ProjectId = (int)Mydb.ExecuteScalar("select PROJECT_ID from OBJECT where OBJECT_ID=@ObjId", new SqlParameter[] { new SqlParameter("@ObjId", ObjId) }, CommandType.Text); result = "{\"result\" : \"1\",\"objId\":\"" + ObjId + "\",\"C_Score\":\"" + Score + "\",\"ProjectId\":\"" + ProjectId + "\"}"; //"{\"result\" : \"1\",\"Id\" :\"" + Client_Id + "\",\"LogId\" :\"" + Id + "\",\"RoleId\":\"" + role + "\"}"; // result = @"{result:1,objId:" + ObjId + ",C_Score:" + Score + ",ProjectDatas:" + ProjectDatas + "}"; } else { int ProjectId = (int)Mydb.ExecuteScalar("select PROJECT_ID from OBJECT where OBJECT_ID=@ObjId", new SqlParameter[] { new SqlParameter("@ObjId", ObjId) }, CommandType.Text); string LoginBitrix = Mydb.ExecuteReadertoDataTableAsJson("usp_CHECK_BITRIX_USER", new SqlParameter[] { new SqlParameter("@login", Score), new SqlParameter("@pwd", PassT) }, CommandType.StoredProcedure); // dynamic jsonSets = JsonConvert.DeserializeObject(sets); dynamic jsonLoginBitrix = JsonConvert.DeserializeObject(LoginBitrix); if (jsonLoginBitrix[0].LOTUS_GUID != "Login failed") { result = "{\"result\" : \"1\",\"objId\":\"" + ObjId + "\",\"C_Score\":\"" + Score + "\",\"ProjectId\":\"" + ProjectId + "\"}"; } else { result = "{\"result\" : \"0\"}"; } } } else { result = "{\"result\" : \"0\"}"; } return(result); }
public static string CheckMail(string mail_) { try { int CountOfMail = (int)Mydb.ExecuteScalar("select count(*) from ACCOUNT WHERE E_MAIL=@m", new SqlParameter[] { new SqlParameter("@m", mail_) }, CommandType.Text); if (CountOfMail > 0) { return("{\"result\" : \"1\"}"); } else// if (CountOfMail==0) { return("{\"result\" : \"2\"}"); } } catch (Exception e) { return("{\" ERROR\" : \"" + e.Message.ToString() + "\"}"); } }
public static string getSelectedServT(int R) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from PRODUCT_SERVICE where SERVICE_ID in (select P_SERVICE_ID from REQUEST_SERVICE where REQUEST_ID=@R)", new SqlParameter[] { new SqlParameter("@R", R) }, CommandType.Text); List <ProductService_> pss = new List <ProductService_>(); foreach (DataRow item in dt.Rows) { ProductService_ ps = new ProductService_(); ps.SERVICE_ID = Convert.ToInt32(item["SERVICE_ID"]); ps.SERVICE_NAME = item["SERVICE_NAME"].ToString(); ps.COST = item["COST"].ToString(); ps.QUANTITY_IS = Convert.ToBoolean(item["QUANTITY_IS"]); pss.Add(ps); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(pss)); }
public static string GetObjAdr(string Pth) { int ObjId = (int)Mydb.ExecuteScalar("GetObjId", new SqlParameter[] { new SqlParameter("@pth", Pth) }, CommandType.StoredProcedure); DataTable dt = Mydb.ExecuteReadertoDataTable("select o.OBJECT_ADRESS,o.OBJECT_NAME, (a.ACCOUNT_NAME + ' > '+a.PHONE_NUMBER+' > '+a.E_MAIL) as Acc from OBJECT o, ACCOUNT a where o.OBJECT_ID=@oid and o.LOG_IN_ID=a.LOG_IN_ID", new SqlParameter[] { new SqlParameter("@oid", ObjId) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.ObjectPhoto = item["OBJECT_NAME"].ToString(); obj.KladrObjectId = item["Acc"].ToString(); obj.Object_Id = ObjId; objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string CheckAttandEmail(string mail, int TipOrg) { try { mail = "%" + mail + "%"; int result = (int)Mydb.ExecuteScalar("select COUNT(*) from ACCOUNT where E_MAIL like @mail and CLIENT_ID=(select CLIENT_ID from CLIENT where ATTRIBUTE_ID=(select ATTRIBUTE_ID from CLIENT_ATTRIBUTE where ATTRIBUTE_ID=@org))", new SqlParameter[] { new SqlParameter("@mail", mail), new SqlParameter("@org", TipOrg) }, CommandType.Text); if (result == 1) { return("{\" result\" : \"1\"}"); } else { return("{\" result\" : \"0\"}"); } } catch (SqlException e) { return("{\" ERROR\" : \"" + e.Message.ToString() + "\"}"); } }
public static string GetTenantRequestTable(string Score) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from VW_TENANT_REQUEST where OBJECT_ID=(select OBJECT_ID from ROOM where ROOM_ID=(select ROOM_ID from PER_SCORE where SCORE_ID=@s)) order by REQUEST_ID desc", new SqlParameter[] { new SqlParameter("@s", Score) }, CommandType.Text); List <RequestTenant> rts = new List <RequestTenant>(); foreach (DataRow item in dt.Rows) { RequestTenant rt = new RequestTenant(); rt.FIRST_NAME = item["FIRST_NAME"].ToString(); rt.ROOM_T = item["REQUEST_ID"].ToString(); rt.ACCOUNT_NAME = item["CR_DATE"].ToString(); rt.ROOM_NUMBER = item["STATUS"].ToString(); rt.PHONE = item["STATUS_ID"].ToString(); rt.INDIVIDUAL_ID = item["DONE_DATE"].ToString(); rts.Add(rt); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rts)); }
public static string GetTRequestById(int rid) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from REQUEST where REQUEST_ID=@rid", new SqlParameter[] { new SqlParameter("@rid", rid) }, CommandType.Text); List <RequestTenant> rts = new List <RequestTenant>(); foreach (DataRow item in dt.Rows) { RequestTenant rt = new RequestTenant(); rt.ACCOUNT_NAME = item["STATUS_ID"].ToString(); rt.INDIVIDUAL_ID = item["INDIVIDUAL_ID"].ToString(); rt.NUMBER = item["COMFORDATE"].ToString(); rt.OBJECT_ID = item["COM_TIME_FROM"].ToString(); rt.ROOM_NUMBER = item["COM_TIME_TO"].ToString(); rt.PHONE = (item["OFFERED_DATE_FROM"].ToString() != "") ? (item["PLAN_END_TIME"].ToString() + "|" + item["PLAN_END_DATE"].ToString() + "|" + item["OFFERED_DATE_FROM"].ToString() + "|" + item["OFFERED_DATE_TO"].ToString() + "|" + item["OFFERED_TIME_FROM1"].ToString() + "|" + item["OFFERED_TIME_FROM2"].ToString() + "|" + item["OFFERED_TIME_TO1"].ToString() + "|" + item["OFFERED_TIME_TO2"].ToString()) : ""; rt.ROOM_T = item["CR_DATE"].ToString(); rt.FIRST_NAME = item["DONE_DATE"].ToString(); // rt.PHONE = + "|" + item["OFFERED_DATE_TO"].ToString() + "|" + item["OFFERED_TIME_FROM1"].ToString() + "|" + item["OFFERED_TIME_FROM2"].ToString() + "|" + item["OFFERED_TIME_TO1"].ToString() + "|" + item["OFFERED_TIME_TO1"].ToString(); rts.Add(rt); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(rts)); }
public static string getMetersValuesT(int mid) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from METER_VALUE where METERS_ID=@mid order by DATE_ desc", new SqlParameter[] { new SqlParameter("@mid", mid) }, CommandType.Text); List <METERS> ms = new List <METERS>(); foreach (DataRow item in dt.Rows) { // AMUNT_TARIF/VALUE_ // LOG_IN_ID/VALUE_2 // METERS_ID/VALUE_3 // NEXT_DATE/DATE_ METERS m = new METERS(); m.AMUNT_TARIF = item["VALUE_"].ToString(); m.LOG_IN_ID = item["VALUE_2"].ToString(); m.METERS_ID = item["VALUE_3"].ToString(); m.NEXT_DATE = item["DATE_"].ToString(); ms.Add(m); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(ms)); }
public static string Change_Supplier_Offer(string guid) { Mydb.ExecuteNoNQuery("Change_Supplier_Offer", new SqlParameter[] { new SqlParameter("@guid", guid) }, CommandType.StoredProcedure); return(""); }
public static string getDocs(string guid) { return(Mydb.ExecuteReadertoDataTableAsJson("Get_Supplier_DOCS", new SqlParameter[] { new SqlParameter("@guid", guid) }, CommandType.StoredProcedure)); }