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 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 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?edit() { int? result = null; int gender = 1; 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()); new StatisticsReportForReferenceServicesDataContext().BooksReceivedEdit( int.Parse(Request["num"].ToString()), userID, startDate, numOfCopies, numOfCopies, ref result); return(result); }
private int?edit() { int? result = null; int gender = 1; 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()); new StatisticsReportForReferenceServicesDataContext().SortingAndOrgnizeEdit( int.Parse(Request["num"].ToString()), userID, startDate, numOfReindex, numOfLabel, numOfRebinding, numOfExclude, ref result); return(result); }
protected void btnSearch_Click(object sender, EventArgs e) { try { DateHG cal = new DateHG(); DateTime?startDate; DateTime?endDate; if (popupDatepicker.Value != null && !string.IsNullOrEmpty(popupDatepicker.Value.ToString())) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { startDate = null; } if (popupDatepickerEnd.Value != null && !string.IsNullOrEmpty(popupDatepickerEnd.Value.ToString())) { endDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepickerEnd.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); } else { endDate = null; } dlUsers.DataSource = new VisitorsDataContext().VistorTacking(null, endDate, startDate).ToList <VistorTackingResult>(); dlUsers.DataBind(); } catch (Exception ex) { Helper.LogError(ex); Response.Redirect("/Visitors/Error.aspx"); } }
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 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?edit() { int? result = null; int gender = 1; 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()); if (hfGender.Value.Equals("1")) { gender = 1; } else { gender = 0; } new StatisticsReportForReferenceServicesDataContext().PhotocopyEdit(int.Parse(Request["num"].ToString()), userID, int.Parse(hfVistorID.Value.ToString()), hfName.Value.ToString(), numOfPages, startDate, numOfbooks, gender, hfMobile.Value.ToString(), ref result); return(result); }
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; } }
public string UserAccessCheck(string userId, bool isRef) { try { string date = ""; if (new DateHG().IsGreg(DateTime.Now.ToString("MM/dd/yyyy"))) { date = DateTime.Now.ToString("MM/dd/yyyy"); } else { date = new DateHG().HijriToGreg(DateTime.Now.ToString("MM/dd/yyyy"), "MM/dd/yyyy"); } RestClient client = null; if (isRef) { client = new RestClient("https://kfnl.gov.sa/Ar/EServices/wfs/_api/web/lists/getbytitle('ScheduleAppointment')/items?$select=Name,Email,Qualification,Mobile,Iqama_x002f_ID,Date,Time&$filter=Date eq \'" + date + "\' and ID eq " + userId) //var client = new RestClient("https://kfnl.gov.sa/Ar/EServices/wfs/_api/web/lists/getbytitle(\'ScheduleAppointment\')/items?$select=Name,Email,Qualification,Mobile,Iqama_x002f_ID,Date&$filter=Date%20eq%20%27" + DateTime.Now.ToString("mm/dd/yyyy") + "%27%20and%20Iqama_x002f_ID%20eq%" + userId) { Timeout = -1 } } ; else { client = new RestClient("https://kfnl.gov.sa/Ar/EServices/wfs/_api/web/lists/getbytitle('ScheduleAppointment')/items?$select=Name,Email,Qualification,Mobile,Iqama_x002f_ID,Date,Time&$filter=Date eq \'" + date + "\' and Iqama_x002f_ID eq " + userId) //var client = new RestClient("https://kfnl.gov.sa/Ar/EServices/wfs/_api/web/lists/getbytitle(\'ScheduleAppointment\')/items?$select=Name,Email,Qualification,Mobile,Iqama_x002f_ID,Date&$filter=Date%20eq%20%27" + DateTime.Now.ToString("mm/dd/yyyy") + "%27%20and%20Iqama_x002f_ID%20eq%" + userId) { Timeout = -1 }; } var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); // return client.BaseUrl.ToString(); // return response.Content; dynamic stuff = JsonConvert.DeserializeObject(response.Content); var val = stuff.value; Console.WriteLine(response.Content); for (int i = 0; i < val.Count; i++) { return(stuff["value"][0]["Name"]); } return(""); } catch (Exception ex) { Helper.LogError(ex); return(""); } }
public static List <int> getHijryDDL() { DateHG cal = new DateHG(); string ddlHtml = string.Empty; int year = cal.getHyear(); List <int> list = new List <int>(); for (int i = 0; i <= 100; i++) { list.Add(year - i); } return(list); }
protected void btnSearch_Click(object sender, EventArgs e) { try { DateHG cal = new DateHG(); DateTime?startDate; if (!string.IsNullOrEmpty(popupDatepicker.Value)) { startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(popupDatepicker.Value.ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat); dlUsers.DataSource = new VisitorsDataContext().GetDaysTransctions(startDate, startDate.Value.AddDays(1));// week after selected date dlUsers.DataBind(); } } catch (Exception ex) { Helper.LogError(ex); Response.Redirect("/Visitors/Error.aspx"); } }
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?numberOfItems = ToNullableInt(txtNumberOfItems.Value.ToString()); int?numberOfPages = ToNullableInt(txtNumberOfPages.Value.ToString()); new StatisticsReportForReferenceServicesDataContext().ItemsAdd(userID, int.Parse(hfVistorID.Value.ToString()), hfName.Value.ToString(), int.Parse(hfGender.Value.ToString()), startDate, null, int.Parse(rblPreiod.SelectedValue.ToString()), int.Parse(rblMethod.SelectedValue.ToString()), int.Parse(rblLang.SelectedValue.ToString()), int.Parse(rblSearchType.SelectedValue.ToString()), int.Parse(rblDegree.SelectedValue.ToString()), hfMobile.Value.ToString(), ckItemType.Items[0].Selected, ckItemType.Items[1].Selected, ckItemType.Items[2].Selected, ckItemType.Items[3].Selected, ckItemType.Items[4].Selected, ckItemType.Items[5].Selected, numberOfItems, numberOfPages, ref result, ref itemID); int?[] arr = { result, itemID }; return(arr); }
protected void dlUsers_ItemDataBound(object sender, DataListItemEventArgs e) { Label lblDate = (Label)e.Item.FindControl("lblDate"); DateTime date = DateTime.Parse(lblDate.Text); String day = string.Empty; switch (date.DayOfWeek.ToString()) { case "Sunday": day = "الأحد"; break; case "Monday": day = "الإثنين"; break; case "Tuesday": day = "الثلاثاء"; break; case "Wednesday": day = "الإربعاء"; break; case "Thursday": day = "الخميس"; break; case "Friday": day = "الجمعة"; break; case "Saturday": day = "السبت"; break; } DateHG cal = new DateHG(); lblDate.Text = cal.GregToHijri(date.ToString()) + " " + day; }
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()); } }
private int?Edit() { int? result = null; int gender = 1; 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?numberOfItems = ToNullableInt(txtNumberOfItems.Value.ToString()); int?numberOfPages = ToNullableInt(txtNumberOfPages.Value.ToString()); if (lblGender.Text.Equals("ذكر")) { gender = 1; } else { gender = 0; } new StatisticsReportForReferenceServicesDataContext().ItemsEdit(int.Parse(Request["num"].ToString()), int.Parse(hfVistorID.Value.ToString()), txtUserName.Value.ToString(), gender, startDate, null, int.Parse(rblPreiod.SelectedValue.ToString()), int.Parse(rblMethod.SelectedValue.ToString()), int.Parse(rblLang.SelectedValue.ToString()), int.Parse(rblSearchType.SelectedValue.ToString()), int.Parse(rblDegree.SelectedValue.ToString()), txtMobile.Value.ToString(), ckItemType.Items[0].Selected, ckItemType.Items[1].Selected, ckItemType.Items[2].Selected, ckItemType.Items[3].Selected, ckItemType.Items[4].Selected, ckItemType.Items[5].Selected, numberOfItems, numberOfPages, ref result); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["UserWebsiteId"] == null) { Response.Redirect("~/Login.aspx?page=" + Request.RawUrl); } if (!IsPostBack) { var q = new VisitorsDataContext().UsersSearch(Request.Cookies["UserWebsiteId"].Value.ToString()).ToList <UsersSearchResult>(); foreach (var item in q) { if (item.UserRole.Equals("admin")) { //liItemsAdd.Visible = true; //liItemsSearch.Visible = true; //liUsersManagement.Visible = true; //liStatistics.Visible = true; } else if (item.UserRole.Equals("user")) { //liItemsAdd.Visible = true; //liItemsSearch.Visible = true; //liUsersManagement.Visible = false; //liStatistics.Visible = false; } if (Request.RawUrl.Contains("Statistics.aspx") || Request.RawUrl.Contains("UsersManagement.aspx")) { if (item.UserRole.Equals("user")) { Response.Redirect("~/Default.aspx?page=" + Request.RawUrl); } } } DateHG cal = new DateHG(); DateTime?startDate; try { if (!string.IsNullOrEmpty(Request["date"].ToString())) { lbldate.Text = Request["date"].ToString(); startDate = DateTime.ParseExact(cal.HijriToGreg(invertDate(Request["date"].ToString())), "yyyy/MM/dd", cal.enCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces); dlUsers.DataSource = new VisitorsDataContext().GetDaysTransctions(startDate, startDate.Value.AddDays(30));// week after selected date dlUsers.DataBind(); } else { Response.Redirect("VistorsWeeklyReport.aspx"); } } catch (NullReferenceException) { Response.Redirect("VistorsWeeklyReport.aspx"); } catch (Exception ex) { Helper.LogError(ex); Response.Redirect("/Visitors/Error.aspx"); } } }
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; } }
protected void dlUsers_ItemDataBound(object sender, ListViewItemEventArgs e) { DateHG cal = new DateHG(); string startDate; if (DataBinder.Eval(e.Item.DataItem, "Receive_Date") != null) { startDate = cal.GregToHijri(DataBinder.Eval(e.Item.DataItem, "Receive_Date").ToString()); } else { startDate = ""; } string endDate; if (DataBinder.Eval(e.Item.DataItem, "Finsh_date") != null) { endDate = cal.GregToHijri(DataBinder.Eval(e.Item.DataItem, "Finsh_date").ToString()); } else { endDate = ""; } ((Label)e.Item.FindControl("lblReceiveDate")).Text = startDate; ((Label)e.Item.FindControl("lblFinshDate")).Text = endDate; int Degree = int.Parse(DataBinder.Eval(e.Item.DataItem, "Degree").ToString()); if (Degree == 0) { ((Label)e.Item.FindControl("lblDegree")).Text = "دكتوراه"; } else if (Degree == 1) { ((Label)e.Item.FindControl("lblDegree")).Text = "ماجستير"; } else if (Degree == 2) { ((Label)e.Item.FindControl("lblDegree")).Text = "جامعي"; } else if (Degree == 3) { ((Label)e.Item.FindControl("lblDegree")).Text = "اخرى"; } int Send_Method = int.Parse(DataBinder.Eval(e.Item.DataItem, "Send_Method").ToString()); if (Send_Method == 0) { ((Label)e.Item.FindControl("lblSendMethod")).Text = "مناولة"; } else if (Send_Method == 1) { ((Label)e.Item.FindControl("lblSendMethod")).Text = "بريد"; } else if (Send_Method == 2) { ((Label)e.Item.FindControl("lblSendMethod")).Text = "بريد الكتروني"; } else if (Send_Method == 3) { ((Label)e.Item.FindControl("lblSendMethod")).Text = "خدمة ذاتية"; } else if (Send_Method == 4) { ((Label)e.Item.FindControl("lblSendMethod")).Text = "هاتف"; } int Period = int.Parse(DataBinder.Eval(e.Item.DataItem, "Period").ToString()); if (Period == 0) { ((Label)e.Item.FindControl("lblPeriod")).Text = "الصباحية"; } else if (Period == 1) { ((Label)e.Item.FindControl("lblPeriod")).Text = "المسائية"; } int Language = int.Parse(DataBinder.Eval(e.Item.DataItem, "Language").ToString()); if (Language == 0) { ((Label)e.Item.FindControl("lblLanguage")).Text = "عربي"; } else if (Language == 1) { ((Label)e.Item.FindControl("lblLanguage")).Text = "انجليزي"; } int Gender = int.Parse(DataBinder.Eval(e.Item.DataItem, "Customer_Gender").ToString()); if (Gender == 0) { ((Label)e.Item.FindControl("lblCustomerGender")).Text = "انثي"; } else if (Gender == 1) { ((Label)e.Item.FindControl("lblCustomerGender")).Text = "ذكر"; } int SearchType = int.Parse(DataBinder.Eval(e.Item.DataItem, "Search_Type").ToString()); if (SearchType == 0) { ((Label)e.Item.FindControl("lblSearchType")).Text = "الفهرس"; } else if (SearchType == 1) { ((Label)e.Item.FindControl("lblSearchType")).Text = "مصادر المعلومات"; } }
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(); } }
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(); }
protected void dlUsers_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType != ListItemType.Footer) { //start filling footer data _totalPer1 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per1").ToString()); _totalPer2 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per2").ToString()); _totalPer3 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per3").ToString()); _totalPer4 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per4").ToString()); _totalPer5 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per5").ToString()); _totalPer6 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per6").ToString()); _totalPer7 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per7").ToString()); _totalPer8 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per8").ToString()); _totalPer9 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per9").ToString()); _totalPer10 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per10").ToString()); _totalPer11 += int.Parse(DataBinder.Eval(e.Item.DataItem, "per11").ToString()); _sumTotal += int.Parse(DataBinder.Eval(e.Item.DataItem, "Total").ToString()); _sumMale += int.Parse(DataBinder.Eval(e.Item.DataItem, "Male").ToString()); _sumFemale += int.Parse(DataBinder.Eval(e.Item.DataItem, "Female").ToString()); //end filling footer data Label lblDate = (Label)e.Item.FindControl("lblDate"); DateTime date = DateTime.Parse(lblDate.Text); String day = string.Empty; switch (date.DayOfWeek.ToString()) { case "Sunday": day = "الأحد"; break; case "Monday": day = "الإثنين"; break; case "Tuesday": day = "الثلاثاء"; break; case "Wednesday": day = "الإربعاء"; break; case "Thursday": day = "الخميس"; break; case "Friday": day = "الجمعة"; break; case "Saturday": day = "السبت"; break; } DateHG cal = new DateHG(); lblDate.Text = cal.GregToHijri(date.ToString()) + " " + day; } else { ((Label)e.Item.FindControl("lblTotalPer1")).Text = _totalPer1.ToString(); ((Label)e.Item.FindControl("lblTotalPer2")).Text = _totalPer2.ToString(); ((Label)e.Item.FindControl("lblTotalPer3")).Text = _totalPer3.ToString(); ((Label)e.Item.FindControl("lblTotalPer4")).Text = _totalPer4.ToString(); ((Label)e.Item.FindControl("lblTotalPer5")).Text = _totalPer5.ToString(); ((Label)e.Item.FindControl("lblTotalPer6")).Text = _totalPer6.ToString(); ((Label)e.Item.FindControl("lblTotalPer7")).Text = _totalPer7.ToString(); ((Label)e.Item.FindControl("lblTotalPer8")).Text = _totalPer8.ToString(); ((Label)e.Item.FindControl("lblTotalPer9")).Text = _totalPer9.ToString(); ((Label)e.Item.FindControl("lblTotalPer10")).Text = _totalPer10.ToString(); ((Label)e.Item.FindControl("lblTotalPer11")).Text = _totalPer11.ToString(); ((Label)e.Item.FindControl("lblSumTotal")).Text = _sumTotal.ToString(); ((Label)e.Item.FindControl("lblSumMale")).Text = _sumMale.ToString(); ((Label)e.Item.FindControl("lblSumFemale")).Text = _sumFemale.ToString(); } }