public object checkUserName(string userName) { Results<DataTable> result = new Results<DataTable>(); try { helperSearch h = new helperSearch(); int list = h.checkUniqUser(userName); if (list == 1) { result.Message = ""; result.IsSuccessfull = true; } else if(list == 2) { result.Message = "نام کاربری تکراری است."; result.IsSuccessfull = false; } return result; } catch { return result; } }
public object SearchInTable(string Name, int firstRow) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.searchVahed(Name, firstRow, firstRow +6 -1); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
public object VahedReqSearch1(short vahedCode) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.searchVahed1(vahedCode); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
//Add To ZoneInfo Table public int AddZone(zoneInfo zi) { helperSearch h = new helperSearch(); try { if (h.checkUniqValue(zi.zoneName, "zoneName", "zoneInfo")) { db.zoneInfos.InsertOnSubmit(zi); db.SubmitChanges(); return 1; } else { return 0; } } catch (Exception error) { return 3; } }
//Add to VahedInfo Table public int AddVahed(vahedInfo vi) { helperSearch h = new helperSearch(); try { if (h.checkUniqValue(vi.vahedName, vi.city)) { db.vahedInfos.InsertOnSubmit(vi); db.SubmitChanges(); return 1; } else return 0; } catch (Exception error) { return 3; } }
public override bool ValidateUser(string username, string password) { string encodedPassword = EncryptPassword(password); helperSearch sHelper = new helperSearch(); Results<userinfo> result = sHelper.checkUserPass(username,encodedPassword); if (result != null) { if (result.IsSuccessfull) { bool isPersistent = false; //FormsAuthentication.SetAuthCookie(username, isPersistent); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, result.Value.userCode.ToString(), DateTime.Now, DateTime.Now.AddMinutes(240), isPersistent, "", FormsAuthentication.FormsCookiePath); System.Web.HttpContext.Current.Session["Name"] = result.Value.fName +" " + result.Value.lName; // System.Web.HttpContext.Current.Session["sazemanCode"] = result.Value.vahedCode.ToString(); System.Web.HttpContext.Current.Session["userCode"] = result.Value.userCode.ToString(); System.Web.HttpContext.Current.Session["admin"] = result.Value.admin.ToString(); string encTicket = FormsAuthentication.Encrypt(ticket); HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); return true; } else { return false; } } else { return false; } }
public object SoftwareReqSeBySoft(Int16 softwareCode) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.searchSoftware2(softwareCode); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
public object SofSearchInTable(string SoftwareName, string CompanyName, string VahedValue, string ZoneValue,string StartDate,string EndDate) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { Int16 vahedCode = Convert.ToInt16(VahedValue); Int16 zoneCode = Convert.ToInt16(ZoneValue); helperSearch sHelper = new helperSearch(); list = sHelper.searchSoftware(SoftwareName, CompanyName, vahedCode, zoneCode, StartDate, EndDate); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
public Results<DataTable> SearchReqSoftware(Int16 userCode) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.searchSoftware1(Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"])); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
public object FillCmbZoneAddSoftware() { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.fillCombo("zoneInfo", "zoneCode", "zoneName"); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }
public Results<DataTable> ZoneReqSearch(int firstRow) { DataTable list = new DataTable(); Results<DataTable> result = new Results<DataTable>(); try { helperSearch sHelper = new helperSearch(); list = sHelper.searchZone(firstRow, firstRow+6 -1); if (list.Rows.Count == 0) { result.Message = ""; result.IsSuccessfull = false; } else { result.Value = list; result.IsSuccessfull = true; } return result; } catch { return result; } }