private void GetData() { StatisticsReportForReferenceServicesDataContext srfs = new StatisticsReportForReferenceServicesDataContext(); var qu = srfs.UsersSearch(userID).Single <UsersSearchResult>(); DateHG cal = new DateHG(); if (qu.User_Role.Equals("admin")) { var q = srfs.BooksReceivedSerach(int.Parse(Request["num"].ToString()), null, null) .Single <BooksReceivedSerachResult>(); popupDatepicker.Value = new DateHG().GregToHijri(q.Receive_Date.ToString()); txtTitles.Value = q.NoTitle.ToString(); txtCopies.Value = q.NoCopy.ToString(); //rblGender.SelectedValue = q.Customer_Gender.ToString(); // popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); } else { var q = srfs .BooksReceivedSerachWithusers(int.Parse(Request["num"].ToString()), userID, null) .Single <BooksReceivedSerachWithusersResult>(); txtTitles.Value = q.NoTitle.ToString(); txtCopies.Value = q.NoCopy.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); } }
private void bindRowOne() { int totalBooks = 0; int totalVitistors = 0; DateHG cal = new DateHG(); DateTime?startDate; DateTime?endDate; if (!string.IsNullOrEmpty(popupDatepicker.Value)) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { startDate = null; } if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) { endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { endDate = null; } var q = new StatisticsReportForReferenceServicesDataContext().BooksReceivedStat(startDate, endDate).ToArray <BooksReceivedStatResult>(); foreach (var item in q) { lblNoCopies.Text = string.IsNullOrEmpty(item.Count_Copies.ToString()) ? "0" : item.Count_Copies.ToString(); lblNoTitles.Text = string.IsNullOrEmpty(item.Count_Titles.ToString()) ? "0" : item.Count_Titles.ToString(); } }
private int?[] insert() { int? result = null; DateHG cal = new DateHG(); DateTime startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //DateTime? endDate; //if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) //{ // endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //} //else //{ // endDate = null; //} int?numOfReindex = ToNullableInt(txtReindex.Value.ToString()); int?numOfRebinding = ToNullableInt(txtBinding.Value.ToString()); int?numOfLabel = ToNullableInt(txtRelabel.Value.ToString()); int?numOfExclude = ToNullableInt(txtExclude.Value.ToString()); var q = new StatisticsReportForReferenceServicesDataContext().SortingAndOrgnizeAdd( userID, startDate, numOfReindex, numOfLabel, numOfRebinding, numOfExclude, ref result).Single <SortingAndOrgnizeAddResult>(); int?[] arr = { result, q.ID }; return(arr); }
private void BindData() { var Query = new StatisticsReportForReferenceServicesDataContext().GetAllUsers().ToList <GetAllUsersResult>(); dlUsers.DataSource = Query; dlUsers.DataBind(); }
private int?[] insert() { int? result = null; DateHG cal = new DateHG(); DateTime startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //DateTime? endDate; //if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) //{ // endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //} //else //{ // endDate = null; //} int?numOfCopies = ToNullableInt(txtCopies.Value.ToString()); int?numOfTitles = ToNullableInt(txtTitles.Value.ToString()); var q = new StatisticsReportForReferenceServicesDataContext().BooksReceivedAdd( userID, startDate, numOfCopies, numOfTitles, ref result).Single <BooksReceivedAddResult>(); int?[] arr = { result, q.ID }; return(arr); }
private int?[] insert() { int?result = null; int?itemID = null; DateHG cal = new DateHG(); DateTime startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //DateTime? endDate; //if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) //{ // endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); //} //else //{ // endDate = null; //} int?numOfbooks = ToNullableInt(txtNoOfBooks.Value.ToString()); int?numOfPages = ToNullableInt(txtNoOfPages.Value.ToString()); var q = new StatisticsReportForReferenceServicesDataContext().PhotocopyAdd(userID, int.Parse(hfVistorID.Value.ToString()), hfName.Value.ToString(), numOfPages, startDate, numOfbooks, int.Parse(hfGender.Value.ToString()), hfMobile.Value.ToString(), ref result).Single <PhotocopyAddResult>(); int?[] arr = { result, q.ID }; return(arr); }
private void GetData() { StatisticsReportForReferenceServicesDataContext srfs = new StatisticsReportForReferenceServicesDataContext(); var qu = srfs.UsersSearch(userID).Single <UsersSearchResult>(); DateHG cal = new DateHG(); if (qu.User_Role.Equals("admin")) { var q = srfs.GeneralCollectionSearch(int.Parse(Request["num"].ToString()), null, null, null, null, null, null, null).Single <GeneralCollectionSearchResult>(); txtUserName.Value = q.Vistor_Name.ToString(); txtMobile.Value = q.MobileNo.ToString(); ddlCounter.SelectedValue = q.Counter_ID.ToString(); txtUserCode.Value = q.Vistor_ID.ToString(); txtNoOfBooks.Value = q.NoBooks.ToString(); //rblGender.SelectedValue = q.Customer_Gender.ToString(); if (q.Gender == 1) { lblGender.Text = "ذكر"; hfGender.Value = "1"; } else { lblGender.Text = "انثى"; hfGender.Value = "0"; } txtSearch.Value = q.Vistor_ID.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); hfVistorID.Value = q.Vistor_ID.ToString(); hfName.Value = q.Vistor_Name; hfMobile.Value = q.MobileNo; } else { var q = srfs.GeneralCollectionSearchWithUsers(int.Parse(Request["num"].ToString()), userID, null, null, null, null, null, null).Single <GeneralCollectionSearchWithUsersResult>(); txtUserName.Value = q.Vistor_Name.ToString(); txtMobile.Value = q.MobileNo.ToString(); ddlCounter.SelectedValue = q.Counter_ID.ToString(); txtUserCode.Value = q.Vistor_ID.ToString(); txtNoOfBooks.Value = q.NoBooks.ToString(); if (q.Gender == 1) { lblGender.Text = "ذكر"; } else { lblGender.Text = "انثى"; } //rblGender.SelectedValue = q.Customer_Gender.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); hfName.Value = q.Vistor_Name; hfMobile.Value = q.MobileNo; } }
private void BindGroups(string Id) { var q = new StatisticsReportForReferenceServicesDataContext().GetGroupsByUserID(Id).ToList(); foreach (var item in q) { try { rblRole.Items.FindByValue((item.Group_ID).ToString()).Selected = true; } catch (Exception) { } } }
private void GetRealDept() { try { var query = new StatisticsReportForReferenceServicesDataContext().GetRealDepartments().ToList <GetRealDepartmentsResult>(); ddlRealDep.DataTextField = "Department_Name"; ddlRealDep.DataValueField = "Department_Id"; ddlRealDep.DataSource = query; ddlRealDep.DataBind(); } catch (Exception ex) { Helper.LogError(ex.Message, ex.StackTrace); Response.Redirect("/Admin/Error.aspx"); } }
protected void dlUsers_ItemDataBound(object sender, DataListItemEventArgs e) { string id = ((Label)e.Item.FindControl("lblID")).Text; var q = new StatisticsReportForReferenceServicesDataContext().UsersSearch(id).Single(); if (q.User_Is_Locked) { ((LinkButton)e.Item.FindControl("lnkbtnState")).Attributes.Remove("class"); ((LinkButton)e.Item.FindControl("lnkbtnState")).Attributes.Add("class", "btn btn-danger"); ((Label)e.Item.FindControl("lblUserState")).Text = "تفعيل"; } else { ((LinkButton)e.Item.FindControl("lnkbtnState")).Attributes.Remove("class"); ((LinkButton)e.Item.FindControl("lnkbtnState")).Attributes.Add("class", "btn btn-success"); ((Label)e.Item.FindControl("lblUserState")).Text = "تعطيل"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Cookies["UserWebsiteId"] == null) { Response.Redirect("~/Default.aspx?page=" + Request.RawUrl); } RestPagesDisplay(); var q = new StatisticsReportForReferenceServicesDataContext().GetGroupsByUserID(new CookieSecurityProvider().Unprotect(Request.Cookies["UserWebsiteId"].Value.ToString())).ToList <GetGroupsByUserIDResult>(); foreach (var item in q) { spnUserName.InnerText = item.User_Name; RolePagesDisplay(item.Group_ID); } } }
private void GetRealDept() { try { var query = new StatisticsReportForReferenceServicesDataContext().GetRealDepartments().ToList <GetRealDepartmentsResult>(); ddlDepartment.DataTextField = "Department_Name"; ddlDepartment.DataValueField = "Department_id"; ddlDepartment.DataSource = query; ddlDepartment.DataBind(); ListItem l = new ListItem("--إختر الإدارة--", "", true); l.Selected = true; ddlDepartment.Items.Insert(0, l); } catch (Exception ex) { Helper.LogError(ex.Message, ex.StackTrace); // Response.Redirect("/Admin/Error.aspx"); } }
public Vistor getVistorByID(string id) { StatisticsReportForReferenceServicesDataContext objDataContext = new StatisticsReportForReferenceServicesDataContext(); Vistor v = new Vistor(); var q = objDataContext.getVistorByID(id).ToList <getVistorByIDResult>(); foreach (var item in q) { if (item.Gender != null) { v.Gender = (bool)item.Gender; } v.Name = item.Name; v.NationalID = item.CivilID; v.Mobile = item.MobileNo; v.vistor_id = item.VisitorID; } return(v); }
private void getData() { ManageGroups(); if (ViewState["ID"] != null) { string ID = ViewState["ID"].ToString(); var QUERY = new StatisticsReportForReferenceServicesDataContext().UsersSearch(ID).ToList <UsersSearchResult>(); foreach (var item in QUERY) { txtUserName.Text = item.User_Name; ddlDepartments.SelectedValue = ActiveDirectoryManagment.GetDepartment(ID); GetAllUsersByDepartment(); ddlUsers.SelectedValue = ID; ddlRealDep.SelectedValue = item.DepartmentID.ToString(); } BindGroups(ID); // rblRole.Items.FindByValue(((int)Helper.GroupsEnum.Admin).ToString()).Selected = true; ddlDepartments.Enabled = false; ddlUsers.Enabled = false; } }
private void bindRowOne() { int totalBooks = 0; int totalVitistors = 0; DateHG cal = new DateHG(); DateTime?startDate; DateTime?endDate; if (!string.IsNullOrEmpty(popupDatepicker.Value)) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { startDate = null; } if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) { endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { endDate = null; } var q = new StatisticsReportForReferenceServicesDataContext().GeneralCollectionStat(startDate, endDate, null).ToArray <GeneralCollectionStatResult>(); if (!string.IsNullOrEmpty(ddlCounter.SelectedValue.ToString())) { q = new StatisticsReportForReferenceServicesDataContext().GeneralCollectionStat(startDate, endDate, int.Parse(ddlCounter.SelectedValue.ToString())).ToArray <GeneralCollectionStatResult>(); } foreach (var item in q) { lblTotalBooks.Text = string.IsNullOrEmpty(item.Count_Books.ToString())?"0": item.Count_Books.ToString(); lblTotalVisitors.Text = string.IsNullOrEmpty(item.Count_Visitors.ToString())?"0": item.Count_Visitors.ToString(); } }
private void GetData() { StatisticsReportForReferenceServicesDataContext srfs = new StatisticsReportForReferenceServicesDataContext(); var qu = srfs.UsersSearch(userID).Single <UsersSearchResult>(); DateHG cal = new DateHG(); if (qu.User_Role.Equals("admin")) { var q = srfs.SortingAndOrgnizeSearch(int.Parse(Request["num"].ToString()), null, null) .Single <SortingAndOrgnizeSearchResult>(); popupDatepicker.Value = new DateHG().GregToHijri(q.Receive_Date.ToString()); txtBinding.Value = q.NoBinding.ToString(); txtExclude.Value = q.NoExclude.ToString(); txtReindex.Value = q.NoReindex.ToString(); txtRelabel.Value = q.NoRelabel.ToString(); //rblGender.SelectedValue = q.Customer_Gender.ToString(); // popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); } else { var q = srfs .SortingAndOrgnizeSearchWithUsers(int.Parse(Request["num"].ToString()), userID, null) .Single <SortingAndOrgnizeSearchWithUsersResult>(); txtBinding.Value = q.NoBinding.ToString(); txtExclude.Value = q.NoExclude.ToString(); txtReindex.Value = q.NoReindex.ToString(); txtRelabel.Value = q.NoRelabel.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); } }
public static string GetDepartment(string username) { string result = string.Empty; // if you do repeated domain access, you might want to do this *once* outside this method, // and pass it in as a second parameter! PrincipalContext yourDomain = new PrincipalContext(ContextType.Domain); // find the user UserPrincipal user = UserPrincipal.FindByIdentity(yourDomain, username); // if user is found if (user != null) { // get DirectoryEntry underlying it DirectoryEntry de = (user.GetUnderlyingObject() as DirectoryEntry); if (de != null) { if (de.Properties.Contains("memberOf")) { var q = new StatisticsReportForReferenceServicesDataContext().GetAllDepartments().ToArray <GetAllDepartmentsResult>(); for (int i = 0; i < de.Properties["memberOf"].Count; i++) { foreach (var item in q) { result = de.Properties["memberOf"][i].ToString(); if (result.Equals(item.Department_Domain)) { return(result); } } } } } } return(null); }
protected void btnSave_Click(object sender, EventArgs e) { int?result = null; //edit case if (ViewState["ID"] != null) { try { result = Edit(); } catch (Exception ex) { Helper.LogError(ex.Message, ex.StackTrace); result = -2; } finally { if (result == 1) { divNotifi.Visible = true; ViewState["ID"] = null; ddlDepartments.Enabled = true; ddlUsers.Enabled = true; divNotifi.Attributes.Add("class", "alert alert-block alert-success fade in"); lblDivNotifiTitle.Text = "تم !"; pDivNotifiDesc.InnerText = "تم تعديل الموظف بنجاح"; } else if (result == -2) { divNotifi.Visible = true; divNotifi.Attributes.Add("class", "alert alert-block alert-error fade in"); lblDivNotifiTitle.Text = "خطأ !"; pDivNotifiDesc.InnerText = "عذرا اتصل بمسؤول النظام"; } Reset(); BindData(); } } // add case else { try { result = Insert(); } catch (Exception ex) { Helper.LogError(ex.Message, ex.StackTrace); // case of user is aready in the system var query = new StatisticsReportForReferenceServicesDataContext().GetAllUsers().ToList <GetAllUsersResult>(); result = -2; foreach (var item in query) { if (ddlUsers.SelectedValue.Equals(item.User_ID)) { result = -3; break; } } } finally { if (result == 1) { divNotifi.Visible = true; divNotifi.Attributes.Add("class", "alert alert-block alert-success fade in"); lblDivNotifiTitle.Text = "تم !"; pDivNotifiDesc.InnerText = "تم اضافة الموظف بنجاح"; } else if (result == -2) { divNotifi.Visible = true; divNotifi.Attributes.Add("class", "alert alert-block alert-error fade in"); lblDivNotifiTitle.Text = "خطأ !"; pDivNotifiDesc.InnerText = "عذرا اتصل بمسؤول النظام"; } else if (result == -3) { divNotifi.Visible = true; divNotifi.Attributes.Add("class", "alert alert-block alert-error fade in"); lblDivNotifiTitle.Text = "خطأ !"; pDivNotifiDesc.InnerText = "عذرا هذا الموظف موجود مسبقا"; } Reset(); BindData(); } } }
private void bindRowOne() { int total = 0; int male = 0; int female = 0; int ar = 0; int eng = 0; int monawla = 0; int mail = 0; int email = 0; int phone = 0; int fax = 0; int am = 0; int pm = 0; int index = 0; int infoDb = 0; int Phd = 0; int master = 0; int Bac = 0; int Othor = 0; int book = 0; int article = 0; int thesis = 0; int document = 0; int image = 0; int manuscript = 0; int numOfItems = 0; int numOfPages = 0; DateHG cal = new DateHG(); DateTime?startDate; DateTime?endDate; if (!string.IsNullOrEmpty(popupDatepicker.Value)) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { startDate = null; } if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) { endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { endDate = null; } var q = new StatisticsReportForReferenceServicesDataContext().StatisticsSearch(startDate, endDate, txtUserName.Text.Trim(), 1, null).ToArray <StatisticsSearchResult>(); if (!string.IsNullOrEmpty(ddlDepartment.SelectedValue.ToString())) { q = new StatisticsReportForReferenceServicesDataContext().StatisticsSearch(startDate, endDate, txtUserName.Text.Trim(), 1, int.Parse(ddlDepartment.SelectedValue.ToString())).ToArray <StatisticsSearchResult>(); } foreach (var item in q) { total++; if (item.Send_Method == 0) { monawla++; } else if (item.Send_Method == 1) { mail++; } else if (item.Send_Method == 2) { email++; } else if (item.Send_Method == 3) { fax++; } else if (item.Send_Method == 4) { phone++; } if (item.Period == 0) { am++; } else if (item.Period == 1) { pm++; } if (item.Language == 0) { ar++; } else if (item.Language == 1) { eng++; } if (item.Customer_Gender == 0) { female++; } else if (item.Customer_Gender == 1) { male++; } if (item.Search_Type == 0) { index++; } else if (item.Search_Type == 1) { infoDb++; } if (item.Degree == 0) { Phd++; } else if (item.Degree == 1) { master++; } else if (item.Degree == 2) { Bac++; } else if (item.Degree == 3) { Othor++; } if (item.IsBook) { book++; } if (item.IsArticle) { article++; } if (item.IsThesis) { thesis++; } if (item.IsDocument) { document++; } if (item.IsImage) { image++; } if (item.IsManuscript) { manuscript++; } int tempNumOfPages = int.TryParse(item.NumOfPages.ToString(), out tempNumOfPages) ? tempNumOfPages : 0; int tempNumOfItems = int.TryParse(item.NumOfItems.ToString(), out tempNumOfItems) ? tempNumOfItems : 0; numOfPages += tempNumOfPages; numOfItems += tempNumOfItems; } lblTotal.Text = total.ToString(); lblAr.Text = ar.ToString(); lblEng.Text = eng.ToString(); lblMonawla.Text = monawla.ToString(); lblMail.Text = mail.ToString(); lblEmail.Text = email.ToString(); lblFax.Text = fax.ToString(); lblPhone.Text = phone.ToString(); lblAM.Text = am.ToString(); lblPM.Text = pm.ToString(); lblIndex.Text = index.ToString(); lblInfoDB.Text = infoDb.ToString(); lblPhd.Text = Phd.ToString(); lblmaster.Text = master.ToString(); lblBac.Text = Bac.ToString(); lblOthor.Text = Othor.ToString(); lblBooks.Text = book.ToString(); lblArticle.Text = article.ToString(); lblThesis.Text = thesis.ToString(); lblDocuments.Text = document.ToString(); lblImages.Text = image.ToString(); lblManuscripts.Text = manuscript.ToString(); lblNumOfPages.Text = numOfPages.ToString(); lblNumOfItems.Text = numOfItems.ToString(); }
private void bindData() { var qu = new StatisticsReportForReferenceServicesDataContext().UsersSearch(userID).Single(); DateHG cal = new DateHG(); DateTime?startDate; DateTime?endDate; if (!string.IsNullOrEmpty(popupDatepicker.Value)) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { startDate = null; } if (!string.IsNullOrEmpty(popupDatepickerEnd.Value)) { endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { endDate = null; } bool isAdmin = false; var userGroups = new StatisticsReportForReferenceServicesDataContext().GetGroupsByUserID(userID).ToList(); foreach (var item in userGroups) { if (item.Group_ID == (int)Helper.GroupsEnum.Admin || item.Group_ID == (int)Helper.GroupsEnum.ItemsAdmin) { isAdmin = true; break; } } if (isAdmin) { var q = new StatisticsReportForReferenceServicesDataContext().ItemsSearchWithUsers(null, null, txtCustomerName.Text.Trim(), null, startDate, endDate, null, null, null, txtUserName.Text.Trim(), null, null, null, null, null, null, null, null, null, null).ToList <ItemsSearchWithUsersResult>();; if (!string.IsNullOrEmpty(ddlDepartment.SelectedValue.ToString())) { q = new StatisticsReportForReferenceServicesDataContext().ItemsSearchWithUsers(null, null, txtCustomerName.Text.Trim(), null, startDate, endDate, null, null, null, txtUserName.Text.Trim(), int.Parse(ddlDepartment.SelectedValue.ToString()), null, null, null, null, null, null, null, null, null).ToList <ItemsSearchWithUsersResult>(); } divNotifi.Visible = true; divNotifi.Attributes.Add("class", "alert alert-block alert-success fade in"); lblDivNotifiTitle.Text = "تم !"; pDivNotifiDesc.InnerText = " مجموع العناصر التي تم العثور عليها " + q.Count; dlItems.DataSource = q; dlItems.DataBind(); } else { divUserName.Visible = false; divpopupDatepicker.Attributes.Add("class", "span4"); divpopupDatepickerEnd.Attributes.Add("class", "span4"); divCustomerName.Attributes.Add("class", "span4"); var q = new StatisticsReportForReferenceServicesDataContext().ItemsSearchWithUsers(null, userID, txtCustomerName.Text.Trim(), null, startDate, endDate, null, null, null, txtUserName.Text.Trim(), null, null, null, null, null, null, null, null, null, null).ToList <ItemsSearchWithUsersResult>(); dlItems.DataSource = q; dlItems.DataBind(); } }
protected void btnLogin_Click(object sender, EventArgs e) { try { string Msg = string.Empty; string UserRoleId = string.Empty; string UserId = txtUserName.Text; string qUserId = null; string qGroups = null; int count = 0; bool isValid = ActiveDirectoryManagment.validateUser(txtUserName.Text, txtPassword.Text); HttpCookie userWebsiteId = new HttpCookie("UserWebsiteId"); HttpCookie securityType = new HttpCookie("SecurityType"); var q = new StatisticsReportForReferenceServicesDataContext().IsValidUser(txtUserName.Text).ToList(); if (q != null && isValid) { foreach (var item in q) { if (!item.User_Is_Locked) { qUserId = item.User_ID.ToString(); // if it is leader or Manager qGroups += item.GroupID.ToString() + "|"; } else { DivMsg.Visible = true; break; } } if (chkRemberMe.Checked) { userWebsiteId.Expires = DateTime.Now.AddDays(30); securityType.Expires = DateTime.Now.AddDays(30); } else { userWebsiteId.Expires = DateTime.Now.AddDays(1); securityType.Expires = DateTime.Now.AddDays(1); } userWebsiteId.Value = new CookieSecurityProvider().Protect(qUserId); securityType.Value = new CookieSecurityProvider().Protect(qGroups); //userWebsiteId.Secure = true; Response.Cookies.Add(userWebsiteId); Response.Cookies.Add(securityType); if (Request.QueryString["page"] == null) { Response.Redirect("/admin/ItemsAdd.aspx"); } else { Response.Redirect(Request.QueryString["page"].ToString()); } } else { DivMsg.Visible = true; } } catch (Exception ex) { DivMsg.Visible = true; DivMsg.InnerHtml = ex.Message; } }
private void GetData() { StatisticsReportForReferenceServicesDataContext srfs = new StatisticsReportForReferenceServicesDataContext(); var qu = srfs.UsersSearch(userID).Single <UsersSearchResult>(); DateHG cal = new DateHG(); bool isAdmin = false; var userGroups = new StatisticsReportForReferenceServicesDataContext().GetGroupsByUserID(userID).ToList(); foreach (var item in userGroups) { if (item.Group_ID == (int)Helper.GroupsEnum.Admin || item.Group_ID == (int)Helper.GroupsEnum.ItemsAdmin) { isAdmin = true; break; } } if (isAdmin) { var q = srfs.ItemsSearchWithUsers(int.Parse(Request["num"].ToString()), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).Single <ItemsSearchWithUsersResult>(); txtUserName.Value = q.Customer_Name.ToString(); txtMobile.Value = q.Mobile.ToString(); rblDegree.SelectedValue = q.Degree.ToString(); //rblGender.SelectedValue = q.Customer_Gender.ToString(); if (q.Customer_Gender == 1) { lblGender.Text = "ذكر"; } else { lblGender.Text = "انثى"; } txtSearch.Value = q.Vistor_ID.ToString(); rblLang.SelectedValue = q.Language.ToString(); rblMethod.SelectedValue = q.Send_Method.ToString(); rblPreiod.SelectedValue = q.Period.ToString(); rblSearchType.SelectedValue = q.Search_Type.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); hfVistorID.Value = q.Vistor_ID.ToString(); txtNumberOfItems.Value = q.NumOfItems.ToString(); txtNumberOfPages.Value = q.NumOfPages.ToString(); ckItemType.Items[0].Selected = q.IsBook; ckItemType.Items[1].Selected = q.IsArticle; ckItemType.Items[2].Selected = q.IsThesis; ckItemType.Items[3].Selected = q.IsDocument; ckItemType.Items[4].Selected = q.IsImage; ckItemType.Items[5].Selected = q.IsManuscript; } else { var q = srfs.ItemsSearchWithUsers(int.Parse(Request["num"].ToString()), userID, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).Single <ItemsSearchWithUsersResult>(); txtUserName.Value = q.Customer_Name.ToString(); txtMobile.Value = q.Mobile.ToString(); rblDegree.SelectedValue = q.Degree.ToString(); if (q.Customer_Gender == 1) { lblGender.Text = "ذكر"; } else { lblGender.Text = "انثى"; } //rblGender.SelectedValue = q.Customer_Gender.ToString(); rblLang.SelectedValue = q.Language.ToString(); rblMethod.SelectedValue = q.Send_Method.ToString(); rblPreiod.SelectedValue = q.Period.ToString(); rblSearchType.SelectedValue = q.Search_Type.ToString(); popupDatepicker.Value = cal.GregToHijri(q.Receive_Date.ToString()); //popupDatepickerEnd.Value = cal.GregToHijri(q.Finsh_date.ToString()); txtNumberOfItems.Value = q.NumOfItems.ToString(); txtNumberOfPages.Value = q.NumOfPages.ToString(); ckItemType.Items[0].Selected = q.IsBook; ckItemType.Items[1].Selected = q.IsArticle; ckItemType.Items[2].Selected = q.IsThesis; ckItemType.Items[3].Selected = q.IsDocument; ckItemType.Items[4].Selected = q.IsImage; ckItemType.Items[5].Selected = q.IsManuscript; } }