예제 #1
0
 private void BindMeetings()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = from b in db.Meetings
                     where b.Meeting_CommitteeID == int.Parse(Request.QueryString["id"])
                     select new
         {
             b.Committee.Committee_Name,
             b.Meeting_ID,
             b.Meeting_Date,
             b.Meeting_Code,
             b.Meeting_TimeFrom,
             b.Meeting_TimeTo,
             b.Meeting_RewardMember,
             b.Meeting_RewardNotMember,
             b.Meeting_TypeID,
             b.Meeting_StatusID,
             b.Meeting_Place,
             b.Meeting_Notes,
             b.MeetingStatus.Status_Name,
             b.MeetingType.Type_Name
         };
         rpMeetings.DataSource = query.OrderByDescending(x => x.Meeting_Date);
         rpMeetings.DataBind();
     }
 }
예제 #2
0
 private void BindData()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = (from b in db.Meetings
                      where b.Meeting_CommitteeID == int.Parse(Request.QueryString["id"])
                      select new
         {
             b.Committee.Committee_Name,
             b.Meeting_ID,
             b.Meeting_Date,
             b.Meeting_Code,
             b.Meeting_TimeFrom,
             b.Meeting_TimeTo,
             b.Meeting_RewardMember,
             b.Meeting_RewardNotMember,
             b.Meeting_TypeID,
             b.Meeting_StatusID,
             b.Meeting_Place,
             b.Meeting_Notes,
             b.MeetingStatus.Status_Name,
             b.MeetingType.Type_Name
         });
         dtData            = query.OrderByDescending(x => x.Meeting_Date).CopyToDataTable();
         rpData.DataSource = dtData;
         rpData.DataBind();
         ltrCount.Text = dtData.Rows.Count.ToString();
     }
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["User"] != null && Session["User"].ToString() != string.Empty)
         {
             if (UserPermissions.Any(
                     p =>
                     p.PageUrl.ToLower().Equals(Common.Meetings) &&
                     (p.Show.Equals(true) || p.Add.Equals(true) || p.Edit.Equals(true) || p.Delete.Equals(true))))
             {
                 var per = UserPermissions.FirstOrDefault(
                     p =>
                     p.PageUrl.ToLower().Equals(Common.Meetings) &&
                     (p.Show.Equals(true) || p.Add.Equals(true) || p.Edit.Equals(true) || p.Delete.Equals(true)));
                 ((HtmlGenericControl)Page.Master.FindControl("ulBreadcrumb")).InnerHtml = "<li><i class='ace-icon fa fa-home home-icon'></i><a href ='Dashboard.aspx'> الرئيسية </a></li><li>" + per.ModuleName + "</li><li>" + per.PageName + "</li><li></li>";
                 Page.Title = per.PageName;
             }
             else
             {
                 Response.Redirect("NoPermission.aspx");
             }
         }
         else
         {
             Session["back"] = Request.Url.AbsoluteUri;
             Response.Redirect("Login.aspx?ReturnURL=" + Request.Url.AbsolutePath);
         }
         using (CultureDataContext db = new CultureDataContext())
         {
             ltrCommitte.Text = db.Committees.FirstOrDefault(x => x.Committee_ID == int.Parse(Request.QueryString["id"])).Committee_Name;
         }
         BindData();
     }
 }
예제 #4
0
 private void BindMembers()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = (from b in db.Members
                      where b.Member_CommitteeID == int.Parse(Request.QueryString["id"])
                      select new
         {
             b.Member_CommitteeID,
             b.Member_ID,
             b.Member_Name,
             b.Member_Notes,
             b.Status.Status_Name,
             b.Member_Address,
             b.Member_StatusID,
             b.Member_As,
             b.Member_Code,
             b.Member_Email,
             b.Member_Mobile,
             b.Role.Role_Name,
             b.MembershipStatus.MembershipStatus_Name,
             Member_Avatar = b.Member_Avatar ?? "App_Themes/images/member.png",
             b.MemberType.MemberType_Name,
             b.Member_MembershipStatusID,
             b.Member_RoleID,
             b.Member_TypeID,
             Rewards = b.Rewards.Any() ? b.Rewards.Sum(x => x.Reward_Value ?? 0) : 0,
             Attendance = b.Committee.Meetings.Count() > 0 ? ((Convert.ToDecimal(b.Attendances.Count()) / Convert.ToDecimal(b.Committee.Meetings.Count())) * decimal.Parse("100")) : 0
         });
         rpMembers.DataSource = query;
         rpMembers.DataBind();
     }
 }
예제 #5
0
    private void FillControls()
    {
        if (ViewState["ID"] != null)
        {
            using (CultureDataContext db = new CultureDataContext())
            {
                var query = db.Meetings.Where(t => t.Meeting_ID.Equals(int.Parse(ViewState["ID"].ToString()))).FirstOrDefault();
                txtDate.Value        = Convert.ToDateTime(query.Meeting_Date).ToShortDateString();
                txtCode.Text         = query.Meeting_Code;
                txtPlace.Text        = query.Meeting_Place;
                txtReward.Text       = query.Meeting_RewardNotMember.ToString();
                txtRewardMember.Text = query.Meeting_RewardMember.ToString();

                txtTimeFrom.Value          = query.Meeting_TimeFrom.ToString();
                txtTimeTo.Value            = query.Meeting_TimeTo.ToString();
                txtDatePostponedUntil.Text = query.Meeting_PostponedUntil != null?Convert.ToDateTime(query.Meeting_PostponedUntil).ToShortDateString() : string.Empty;

                txtNotes.Text = query.Meeting_Notes;
                divDatePostponedUntil.Visible = query.Meeting_PostponedUntil != null ? true : false;
                btnApprove.Visible            = btnSave.Visible = btnFreeze.Visible = btnPostponed.Visible = query.Meeting_StatusID == (int)StatusEnum.UnderApprove;
                rdType1.Checked = query.Meeting_TypeID == 1;
                rdType2.Checked = query.Meeting_TypeID == 2;
                btnSave.Visible = query.Meeting_StatusID == 4 ? true : query.Meeting_StatusID == 1 ? true : false;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'>$('#meetingModal').modal('show');</script>", false);
            }
        }
    }
예제 #6
0
    private void BindDDL(bool rebindMembers)
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            if (rebindMembers == false)
            {
                var query = from q in db.Groups
                            select new
                {
                    q.Group_ID,
                    q.Group_Name
                };
                ddlGroup.Items.Clear();
                ddlGroup.DataSource     = query;
                ddlGroup.DataTextField  = "Group_Name";
                ddlGroup.DataValueField = "Group_ID";
                ddlGroup.DataBind();
                ddlGroup.Items.Insert(0, new ListItem("اختر", "-1"));

                ddlGroupSrc.Items.Clear();
                ddlGroupSrc.DataSource     = query;
                ddlGroupSrc.DataTextField  = "Group_Name";
                ddlGroupSrc.DataValueField = "Group_ID";
                ddlGroupSrc.DataBind();
                ddlGroupSrc.Items.Insert(0, new ListItem("اختر", "-1"));

                var query1 = from q in db.Committees
                             select new
                {
                    q.Committee_ID,
                    q.Committee_Name
                };
                ddlCommittee.Items.Clear();
                ddlCommittee.DataSource     = query1;
                ddlCommittee.DataTextField  = "Committee_Name";
                ddlCommittee.DataValueField = "Committee_ID";
                ddlCommittee.DataBind();
                ddlCommittee.Items.Insert(0, new ListItem("اختر", "-1"));

                ddlCommitteeSrc.Items.Clear();
                ddlCommitteeSrc.DataSource     = query1;
                ddlCommitteeSrc.DataTextField  = "Committee_Name";
                ddlCommitteeSrc.DataValueField = "Committee_ID";
                ddlCommitteeSrc.DataBind();
                ddlCommitteeSrc.Items.Insert(0, new ListItem("اختر", "-1"));
            }
            var query2 = from q in db.Members
                         select new
            {
                q.Member_ID,
                q.Member_Name
            };
            ddlMember.Items.Clear();
            ddlMember.DataSource     = query2;
            ddlMember.DataTextField  = "Member_Name";
            ddlMember.DataValueField = "Member_ID";
            ddlMember.DataBind();
            ddlMember.Items.Insert(0, new ListItem("اختر", "-1"));
        }
    }
예제 #7
0
 protected void lnkSignIn_Click(object sender, EventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = (from q in db.Users
                      where q.User_Email.Equals(txtEmail.Text.Trim()) &&
                      q.User_Password.Equals(EncryptString.Encrypt(txtPassword.Text))
                      select q).FirstOrDefault();
         if (query != null)
         {
             if (query.User_StatusID == (int)StatusEnum.Approved)
             {
                 Session["User"] = ClientDetails.SerializeClientDetails(new ClientDetails(query.User_ID, query.User_FullName, query.User_Email, query.User_Mobile1, db.GroupUsers.FirstOrDefault(x => x.GroupUser_UserID.Equals(query.User_ID)).GroupUser_GroupID ?? 0, query.User_CommitteeID ?? 0));
                 var per = db.SP_SelectUserPermission(query.User_ID).ToList();
                 List <UserPermissions> tempList = UserPermissions;
                 tempList.AddRange(
                     per.Select(
                         i =>
                         new UserPermissions(i.ModuleID, i.ModuleName, i.PageName, i.PageURL,
                                             bool.Parse(i.Show), bool.Parse(i.Add), bool.Parse(i.Edit), bool.Parse(i.Delete), bool.Parse(i.Index))));
                 UserPermissions = tempList;
                 Response.Redirect("default.aspx");
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertUser",
                                                 "alert('عفوا، المستخدم غير موجود');", true);
         }
     }
 }
예제 #8
0
 private void BindGroups()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         try {
             var query = from t in db.Groups
                         select new
             {
                 t.Group_ID,
                 t.Group_Name
             };
             if (txtNameSrch.Text.Trim() != string.Empty)
             {
                 query = query.Where(x => x.Group_Name.Contains(txtNameSrch.Text.Trim()));
             }
             ltrCount.Text     = query.Count().ToString();
             rpData.DataSource = query;
             rpData.DataBind();
         }
         catch (Exception ex)
         {
             string             sPath    = HttpContext.Current.Request.Url.AbsolutePath;
             System.IO.FileInfo oInfo    = new System.IO.FileInfo(sPath);
             string             PageName = oInfo.Name;
             StackTrace         st       = new StackTrace(ex, true);
             StackFrame         sf       = new StackFrame(0);
             Common.InsertException(PageName, ex.Message, ex.StackTrace, int.Parse(sf.GetFileLineNumber().ToString()));
             ScriptManager.RegisterStartupScript(this, GetType(), "alertUser",
                                                 "alert('حدث خطأ اثناء التنفيذ');", true);
         }
     }
 }
예제 #9
0
 protected void lnkPayment_Click(object sender, EventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         try
         {
             int count = 0;
             foreach (RepeaterItem item in rpRewards.Items)
             {
                 HtmlInputCheckBox chkDisplayTitle = (HtmlInputCheckBox)item.FindControl("check");
                 if (chkDisplayTitle.Checked)
                 {
                     Reward a = db.Rewards.FirstOrDefault(x => x.Reward_ID == int.Parse(chkDisplayTitle.Value));
                     a.Reward_PaymentStatusID = 2;
                     a.Reward_PaymentDate     = DateTime.Now;
                     db.SubmitChanges();
                     count++;
                 }
             }
             if (count == 0)
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> $('body').removeClass('modal-open');alert('يرجى تحديد المكافأت');</script>", false);
             }
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> $('body').removeClass('modal-open');alert('تم الحفظ بنجاح');</script>", false);
             BindData();
         }
         catch (Exception exception)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('حدث خطا اثناء الحفظ');</script>", false);
             //Logger.ErrorLog(exception);
         }
     }
 }
예제 #10
0
    private void BindDDl()
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            var query = db.PaymentStatus.Select(x => new
            {
                x.PaymentStatus_ID,
                x.PaymentStatus_Name
            });
            ddlStatusSrc.DataSource     = query;
            ddlStatusSrc.DataTextField  = "PaymentStatus_Name";
            ddlStatusSrc.DataValueField = "PaymentStatus_ID";
            ddlStatusSrc.DataBind();
            ddlStatusSrc.Items.Insert(0, new ListItem("اختر", "0"));

            var query2 = from m in db.Members
                         select new
            { m.Member_ID, m.Member_Name };
            ddlMember.DataSource     = query2;
            ddlMember.DataTextField  = "Member_Name";
            ddlMember.DataValueField = "Member_ID";
            ddlMember.DataBind();
            ddlMember.Items.Insert(0, new ListItem("اختر", "0"));
        }
    }
예제 #11
0
 protected void btnSaveReward_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         using (CultureDataContext db = new CultureDataContext())
         {
             try
             {
                 Reward q = new Reward()
                 {
                     Reward_Value           = decimal.Parse(txtValue.Text),
                     Reward_Date            = DateTime.Now,
                     Reward_IsException     = true,
                     Reward_PaymentStatusID = 1,
                     Reward_MemberID        = int.Parse(ddlMember.SelectedValue)
                 };
                 db.Rewards.InsertOnSubmit(q);
                 db.SubmitChanges();
                 BindData();
                 txtValue.Text           = string.Empty;
                 ddlMember.SelectedValue = "0";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'>$('body').removeClass('modal-open'); alert('تم الحفظ بنجاح');$('#rewardAddModal').modal('hide');$('.modal-backdrop').remove();</script>", false);
             }
             catch (Exception exception)
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('حدث خطا اثناء الحفظ');</script>", false);
                 //Logger.ErrorLog(exception);
             }
         }
     }
 }
예제 #12
0
 protected void btnSaveAttachment_Click(object sender, EventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         if (fuAttach.HasFile)
         {
             string path = Server.MapPath("RewardsAttachments/");
             while (File.Exists(path + fuAttach.FileName))
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('يوجد مرفق بنفس الاسم');</script>", false);
                 return;
             }
             fuAttach.SaveAs(path + fuAttach.FileName);
             RewardAttachment q = new RewardAttachment();
             q.Attachment_File     = "RewardsAttachments/" + fuAttach.FileName;
             q.Attachment_Name     = txtFileName.Text;
             q.Attachment_RewardID = int.Parse(ViewState["ID"].ToString());
             db.RewardAttachments.InsertOnSubmit(q);
             db.SubmitChanges();
             txtFileName.Text = string.Empty;
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> $('body').removeClass('modal-open');alert('تم الحفظ بنجاح');$('#attachmentsModal').modal('show');</script>", false);
             BindAttachments();
         }
     }
 }
예제 #13
0
 protected void lnkDeleteGroup_Command(object sender, CommandEventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         try
         {
             var pr = db.GroupPrivileges.Where(x => x.GroupPrivilege_GroupID.Equals(int.Parse(e.CommandArgument.ToString())));
             db.GroupPrivileges.DeleteAllOnSubmit(pr);
             Group u = db.Groups.FirstOrDefault(x => x.Group_ID.Equals(int.Parse(e.CommandArgument.ToString())));
             if (u != null)
             {
                 db.Groups.DeleteOnSubmit(u);
             }
             db.SubmitChanges();
             BindGroups();
             ScriptManager.RegisterStartupScript(this, GetType(), "alertGroup", "alert('تم الحذف بنجاح .');", true);
         }
         catch (Exception ex)
         {
             string             sPath    = HttpContext.Current.Request.Url.AbsolutePath;
             System.IO.FileInfo oInfo    = new System.IO.FileInfo(sPath);
             string             PageName = oInfo.Name;
             StackTrace         st       = new StackTrace(ex, true);
             StackFrame         sf       = new StackFrame(0);
             Common.InsertException(PageName, ex.Message, ex.StackTrace, int.Parse(sf.GetFileLineNumber().ToString()));
             ScriptManager.RegisterStartupScript(this, GetType(), "alertUser",
                                                 "alert('حدث خطأ اثناء التنفيذ');", true);
         }
     }
 }
예제 #14
0
 private void BindData()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = (from b in db.Committees
                      where b.Committee_ID == int.Parse(Request.QueryString["id"])
                      select new
         {
             b.Committee_ID,
             b.Committee_Name,
             b.Committee_Code,
             b.Status.Status_Name,
             b.Committee_StatusID,
             b.Committee_About,
             AttachmentCount = b.CommitteeAttachments.Count(),
             MembersCount = b.Members.Count(),
             GoalCount = b.CommitteeGoals.Count(),
             MeetingsCount = b.Meetings.Count(),
             Attendance = b.Meetings.Count() > 0 ? ((Convert.ToDecimal(b.Meetings.Sum(x => x.Attendances.Count())) / Convert.ToDecimal(b.Meetings.Count() * b.Members.Count())) * decimal.Parse("100")) : 0
         });
         dtData            = query.CopyToDataTable();
         rpData.DataSource = dtData;
         rpData.DataBind();
     }
 }
예제 #15
0
    private void BindDDL()
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            var query = from q in db.Committees
                        select new
            {
                q.Committee_ID,
                q.Committee_Name
            };
            ddlCommittee.DataSource     = query;
            ddlCommittee.DataTextField  = "Committee_Name";
            ddlCommittee.DataValueField = "Committee_ID";
            ddlCommittee.DataBind();
            ddlCommittee.Items.Insert(0, new ListItem("-- اختر --", "0"));

            ddlMembershipSrc.DataSource     = db.MembershipStatus;
            ddlMembershipSrc.DataTextField  = "MembershipStatus_Name";
            ddlMembershipSrc.DataValueField = "MembershipStatus_ID";
            ddlMembershipSrc.DataBind();
            ddlMembershipSrc.Items.Insert(0, new ListItem("-- اختر --", "0"));

            ddlRoleSrc.DataSource     = db.Roles;
            ddlRoleSrc.DataTextField  = "Role_Name";
            ddlRoleSrc.DataValueField = "Role_ID";
            ddlRoleSrc.DataBind();
            ddlRoleSrc.Items.Insert(0, new ListItem("-- اختر --", "0"));

            ddlTypeSrc.DataSource     = db.MemberTypes;
            ddlTypeSrc.DataTextField  = "MemberType_Name";
            ddlTypeSrc.DataValueField = "MemberType_ID";
            ddlTypeSrc.DataBind();
            ddlTypeSrc.Items.Insert(0, new ListItem("-- اختر --", "0"));
        }
    }
예제 #16
0
    private void AddNotification(int type, int member, CultureDataContext db)
    {
        MemberNotification n = new MemberNotification();

        n.MemberNotification_MemberID           = member;
        n.MemberNotification_NotificationTypeID = type;
        db.MemberNotifications.InsertOnSubmit(n);
        db.SubmitChanges();
    }
예제 #17
0
 protected void lnkEditGoal_Command(object sender, CommandEventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         CommitteeGoal g = db.CommitteeGoals.FirstOrDefault(x => x.Goal_ID.Equals(int.Parse(e.CommandArgument.ToString())));
         txtGoal.Text        = g.Goal_Text;
         ViewState["GoalID"] = e.CommandArgument.ToString();
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'>$('#goalsAddModal').modal('show');</script>", false);
     }
 }
예제 #18
0
 protected void lnkSubmitEditGroup_Click(object sender, EventArgs e)
 {
     Page.Validate("vgSave");
     if (Page.IsValid)
     {
         using (CultureDataContext db = new CultureDataContext())
         {
             try
             {
                 int groupId = 0;
                 if (ViewState["ID"] != null)
                 {
                     Group u =
                         db.Groups.FirstOrDefault(x => x.Group_ID.Equals(int.Parse(ViewState["ID"].ToString())));
                     if (u != null)
                     {
                         u.Group_Name = txtName.Text;
                         groupId      = u.Group_ID;
                     }
                 }
                 else
                 {
                     Group u = new Group();
                     u.Group_Name = txtName.Text.Trim();
                     db.Groups.InsertOnSubmit(u);
                     db.SubmitChanges();
                     groupId = u.Group_ID;
                 }
                 db.SubmitChanges();
                 SavePermissions(groupId);
                 ClearGroupControls();
                 DataTable table = GetDataTable();
                 CreateTreeViewNodesRecursive(table, tvPermissions.Nodes, "0");
                 BindGroups();
                 ScriptManager.RegisterStartupScript(this, GetType(), "alertGroup",
                                                     "alert('تم الحفظ بنجاح .');$('#groupAddModal').modal('hide');$('.modal-backdrop').remove();", true);
             }
             catch (Exception ex)
             {
                 string             sPath    = HttpContext.Current.Request.Url.AbsolutePath;
                 System.IO.FileInfo oInfo    = new System.IO.FileInfo(sPath);
                 string             PageName = oInfo.Name;
                 StackTrace         st       = new StackTrace(ex, true);
                 StackFrame         sf       = new StackFrame(0);
                 Common.InsertException(PageName, ex.Message, ex.StackTrace, int.Parse(sf.GetFileLineNumber().ToString()));
                 ScriptManager.RegisterStartupScript(this, GetType(), "alertUser",
                                                     "alert('حدث خطأ اثناء التنفيذ');", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'>$('#groupAddModal').modal('show');</script>", false);
     }
 }
예제 #19
0
 private void SavePermissions(int group)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var pr = db.GroupPrivileges.Where(x => x.GroupPrivilege_GroupID.Equals(group));
         db.GroupPrivileges.DeleteAllOnSubmit(pr);
         db.SubmitChanges();
         TreeViewNode MainNode = tvPermissions.Nodes[0];
         PrintNodesRecursive(MainNode, group);
     }
 }
예제 #20
0
 protected void lnkDeleteGoal_Command(object sender, CommandEventArgs e)
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         CommitteeGoal g = db.CommitteeGoals.FirstOrDefault(x => x.Goal_ID.Equals(int.Parse(e.CommandArgument.ToString())));
         db.CommitteeGoals.DeleteOnSubmit(g);
         db.SubmitChanges();
         BindGoals();
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('تم الحفظ بنجاح');$('#goalsModal').modal('show');</script>", false);
     }
 }
예제 #21
0
    protected void cvName_ServerValidate(object source, ServerValidateEventArgs args)
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            int id = ViewState["ID"] != null?int.Parse(ViewState["ID"].ToString()) : 0;

            args.IsValid =
                !db.Groups.Any(
                    c => c.Group_ID != id &&
                    c.Group_Name.ToLower().Equals(txtName.Text.Trim().ToLower()));
        }
    }
예제 #22
0
    protected void cvMobile_ServerValidate(object source, ServerValidateEventArgs args)
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            int id = ViewState["ID"] != null?int.Parse(ViewState["ID"].ToString()) : 0;

            args.IsValid =
                !db.Users.Any(
                    c => c.User_ID != id &&
                    c.User_Mobile1.Equals(txtMobile.Text.Trim()));
        }
    }
예제 #23
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         using (CultureDataContext db = new CultureDataContext())
         {
             try
             {
                 if (ViewState["ID"] == null)
                 {
                     //int code = 1;
                     //Committee c = db.Committees.OrderByDescending(x => x.Committee_ID).FirstOrDefault();
                     //if (c != null)
                     //    code = int.Parse(c.Committee_Code.Substring(0, 2)) + 1;
                     int       code = 1;
                     Committee c    = db.Committees.OrderByDescending(x => x.Committee_ID).FirstOrDefault();
                     if (c != null)
                     {
                         code = int.Parse(c.Committee_Code) + 20;
                     }
                     Committee q = new Committee()
                     {
                         Committee_Name     = txtName.Text,
                         Committee_StatusID = (int)StatusEnum.UnderApprove,
                         Committee_Code     = code.ToString().PadLeft(3, '0'),
                         Committee_About    = txtAbout.Text,
                         Committee_Notes    = txtNotes.Text
                     };
                     db.Committees.InsertOnSubmit(q);
                 }
                 else
                 {
                     Committee q = db.Committees.FirstOrDefault(x => x.Committee_ID.Equals(int.Parse(ViewState["ID"].ToString())));
                     q.Committee_Name  = txtName.Text;
                     q.Committee_About = txtAbout.Text;
                     q.Committee_Notes = txtNotes.Text;
                 }
                 db.SubmitChanges();
                 ClearControls();
                 BindData();
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('تم الحفظ بنجاح');$('#committeeModal').modal('hide');$('.modal-backdrop').remove();</script>", false);
             }
             catch (Exception exception)
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'> alert('حدث خطا اثناء الحفظ');</script>", false);
                 //Logger.ErrorLog(exception);
             }
         }
     }
 }
예제 #24
0
    protected void lnkEditUser_Command(object sender, CommandEventArgs e)
    {
        using (CultureDataContext db = new CultureDataContext())
        {
            try
            {
                ViewState["ID"] = e.CommandArgument;
                var u = (from t in db.Users
                         where t.User_ID.Equals(int.Parse(e.CommandArgument.ToString()))
                         select new
                {
                    t.User_ID,
                    t.User_FullName,
                    t.User_Email,
                    t.User_Mobile1,
                    t.User_Password,
                    t.User_StatusID,
                    t.Status.Status_Name,
                    t.User_CommitteeID,
                    t.User_MemberID,
                    GroupUser_GroupID = t.GroupUsers.Any() ? t.GroupUsers.FirstOrDefault().GroupUser_GroupID : -1
                }).FirstOrDefault();
                if (u != null)
                {
                    ddlMember.SelectedValue = u.User_MemberID != null?u.User_MemberID.ToString() : "-1";

                    ddlCommittee.SelectedValue = u.User_CommitteeID != null?u.User_CommitteeID.ToString() : "-1";

                    txtFullName.Text          = u.User_FullName;
                    txtRegUsername.Text       = u.User_Email;
                    txtMobile.Text            = u.User_Mobile1;
                    lnkSubmitEditUser.Visible = u.User_StatusID == (int)StatusEnum.Approved;
                    ddlGroup.SelectedValue    = u.GroupUser_GroupID.ToString();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Startup", "<script language='javascript'>$('#groupAddModal').modal('show');</script>", false);
                }
            }
            catch (Exception ex)
            {
                string             sPath    = HttpContext.Current.Request.Url.AbsolutePath;
                System.IO.FileInfo oInfo    = new System.IO.FileInfo(sPath);
                string             PageName = oInfo.Name;
                StackTrace         st       = new StackTrace(ex, true);
                StackFrame         sf       = new StackFrame(0);
                Common.InsertException(PageName, ex.Message, ex.StackTrace, int.Parse(sf.GetFileLineNumber().ToString()));
                ScriptManager.RegisterStartupScript(this, GetType(), "alertUser",
                                                    "alert('حدث خطأ اثناء التنفيذ');", true);
            }
        }
    }
예제 #25
0
 private void FillDropDown()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = db.DiscussionPriorities.Select(x => new
         {
             x.DiscussionPriority_ID,
             x.DiscussionPriority_Name
         });
         ddlDiscussionPriority.DataSource     = query;
         ddlDiscussionPriority.DataTextField  = "DiscussionPriority_Name";
         ddlDiscussionPriority.DataValueField = "DiscussionPriority_ID";
         ddlDiscussionPriority.DataBind();
     }
 }
예제 #26
0
    public static void InsertException(string exceptionPageName, string exceptionMessage, string exceptionFuncation,
                                       int exceptionLineNumber)
    {
        var db = new CultureDataContext();
        var tblLogException = new LogException();

        tblLogException.Excep_Date        = DateTime.Now;
        tblLogException.Excep_Message     = exceptionMessage;
        tblLogException.Excep_Page_Name   = exceptionPageName;
        tblLogException.Excep_Fun_Name    = exceptionFuncation;
        tblLogException.Excep_Line_Number = exceptionLineNumber;
        db.LogExceptions.InsertOnSubmit(tblLogException);
        db.SubmitChanges();
        db.Dispose();
    }
예제 #27
0
 private void BindGoals()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = from q in db.CommitteeGoals
                     where q.Goal_CommitteeID == int.Parse(Request.QueryString["id"])
                     select new
         {
             q.Goal_ID,
             q.Goal_Text
         };
         rpGoals.DataSource = query;
         rpGoals.DataBind();
     }
 }
예제 #28
0
 private void BindAttendance()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = from q in db.Meetings
                     where q.Meeting_CommitteeID == (db.Members.FirstOrDefault(x => x.Member_ID == int.Parse(Request.QueryString["id"])).Member_CommitteeID)
                     select new
         {
             q.Meeting_Code,
             q.Meeting_Date,
             Attendance = q.Attendances.Any(x => x.Attendance_MemberID == int.Parse(Request.QueryString["id"]))?"نعم":"لا"
         };
         rpAttendance.DataSource = query;
         rpAttendance.DataBind();
     }
 }
예제 #29
0
 private void BindAttachments()
 {
     using (CultureDataContext db = new CultureDataContext())
     {
         var query = from q in db.MemberAttachments
                     where q.Attachment_MemberID == int.Parse(Request.QueryString["id"])
                     select new
         {
             q.Attachment_Name,
             q.Attachment_File,
             q.Attachment_ID
         };
         rpAttachments.DataSource = query;
         rpAttachments.DataBind();
     }
 }
예제 #30
0
 private void SavePhone(CultureDataContext db, Member q)
 {
     string[] checkedCheckBoxes = (Request.Form["chkWhatsapp"] ?? string.Empty).ToString().Split(',');
     for (int i = 1; i <= int.Parse(hdfIndex.Value); i++)
     {
         var val = Request.Form["phone[" + i.ToString() + "]"];
         if (val != null && val != string.Empty)
         {
             MemberPhone p = new MemberPhone();
             p.Member               = q;
             p.MemberPhone_Number   = val;
             p.MemberPhone_WhatsApp = checkedCheckBoxes.Any(s => s.Contains(i.ToString()));
             db.MemberPhones.InsertOnSubmit(p);
         }
     }
 }