Exemple #1
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            //chk gc
            var gc = (from g in db.GCTransactions
                      where g.GCNumber == Request.QueryString["gcId"]
                      select g).FirstOrDefault();

            gc.ApprovedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());


            //check if cancelled
            if (gc.StatusGC == "Cancelled")
            {
                Javascript.ShowModal(this, this, "cancelledGCModal");
            }
            else
            {
                gc.StatusGC       = "Waiting";
                gc.ApprovalStatus = "Approved";
                db.SubmitChanges();

                //audit trail
                DBLogger.Log("Update", "Approved GC", gc.GCNumber);

                Response.Redirect("~/gcapproval/default.aspx");
            }
        }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            GCTransaction gc = (from tr in db.GCTransactions
                                where tr.GCNumber == Request.QueryString["gcId"]
                                select tr).FirstOrDefault();

            //chk if modified gc number from prev
            if (txtGCNumber.Text != hfGCNumber.Value)
            {
                var gcs = (from gctran in db.GCTransactions
                           where gctran.GCNumber == txtGCNumber.Text.Trim()
                           select gctran).ToList();

                if (gcs.Count > 0)
                {
                    //show duplicate gc
                    Javascript.ShowModal(this, this, "duplicateGCModal");
                }
                else
                {
                    gc.GCNumber = txtGCNumber.Text;
                }
            }

            gc.DateIssued = Convert.ToDateTime(txtDateIssued.Text);
            gc.GCType     = ddlGCType.SelectedItem.Text;

            if (txtExpirationDate.Text != String.Empty)
            {
                gc.ExpirationDate = Convert.ToDateTime(txtExpirationDate.Text);
            }
            else
            {
                gc.ExpirationDate = null;
            }

            gc.Remarks = txtRemarks.Text;
            //gc.RequestedBy = txtRequestedBy.Text;

            //chk if rooms
            if (gc.RoomId != null)
            {
                gc.RoomId        = Convert.ToInt32(ddlRooms.SelectedValue);
                gc.WithBreakfast = Convert.ToBoolean(rblRoomBreakfast.SelectedValue);
                gc.HeadCount     = Convert.ToInt32(txtRoomHeadCount.Text);
            }
            else if (gc.DiningId != null)
            {
                gc.DiningId     = Convert.ToInt32(ddlDining.SelectedValue);
                gc.DiningTypeId = Convert.ToInt32(ddlDiningType.SelectedValue);
                gc.HeadCount    = Convert.ToInt32(txtDiningHeadCount.Text);
            }

            db.SubmitChanges();

            //audit trail
            DBLogger.Log("Update", "Updated GC", gc.GCNumber);

            Response.Redirect("~/gcapproval/default.aspx");
        }
Exemple #3
0
        protected void gvIR_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("editRecord"))
            {
                int index = Convert.ToInt32(e.CommandArgument);
                int irId  = Convert.ToInt32(gvIR.DataKeys[index].Value);

                Response.Redirect("~/ir/view-irform.aspx?Id=" + irId.ToString());
            }
            else if (e.CommandName.Equals("solveRecord"))
            {
                int index = Convert.ToInt32(e.CommandArgument);
                int irId  = Convert.ToInt32(gvIR.DataKeys[index].Value);

                hfSolveId.Value = irId.ToString();

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#solveModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("deleteRecord"))
            {
                int index = Convert.ToInt32(e.CommandArgument);
                int irId  = Convert.ToInt32(gvIR.DataKeys[index].Value);

                hfDeleteId.Value = irId.ToString();

                Javascript.ShowModal(this, this, "deleteModal");

                //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                //sb.Append(@"<script type='text/javascript'>");
                //sb.Append("$('#deleteModal').modal('show');");
                //sb.Append(@"</script>");
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
            }
        }
Exemple #4
0
        protected void gvGC_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("redirectGuest"))
            {
                int    index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((LinkButton)gvGC.Rows[index].FindControl("lbtnGuestId")).Text;

                //chk if company
                var g = (from gu in db.Guests
                         where gu.Id == Convert.ToInt32(rowId)
                         select gu).FirstOrDefault();

                if (g.IsCompany == true)
                {
                    Response.Redirect("~/company/edit-company.aspx?companyId=" + rowId);
                }
                else
                {
                    Response.Redirect("~/guest/editguest.aspx?guestid=" + rowId);
                }
            }
            else if (e.CommandName.Equals("redirectGC"))
            {
                int    index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((LinkButton)gvGC.Rows[index].FindControl("lblGCNo")).Text;
                Response.Redirect("~/tran/editgcform.aspx?gcId=" + rowId);
            }
            else if (e.CommandName.Equals("approveRecord"))
            {
                int    index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((Label)gvGC.Rows[index].FindControl("lblRowId")).Text;

                hfApproveGCId.Value = rowId;

                //check if gc is status and modify text
                var tran = (from gc in db.GCTransactions
                            where gc.Id == Convert.ToInt32(hfApproveGCId.Value)
                            select gc).FirstOrDefault();

                if (tran.StatusGC == "Cancelled")
                {
                    lblApproveTitle.Text   = "Approve Cancelled Gift Check";
                    lblApproveContent.Text = "Are you sure you want to approve this Cancelled Gift Check and move it to History?";
                }

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#approveModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("disapproveRecord"))
            {
                int    index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((Label)gvGC.Rows[index].FindControl("lblRowId")).Text;

                hfDisapproveGCId.Value = rowId;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#disapproveModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("deleteRecord"))
            {
                int    index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((Label)gvGC.Rows[index].FindControl("lblRowId")).Text;
                hfDeleteGCId.Value = rowId;
                Javascript.ShowModal(this, this, "deleteModal");
            }
        }
Exemple #5
0
 protected void btnOpenModal_Click(object sender, EventArgs e)
 {
     Javascript.ShowModal(this, this, "addModal");
 }
Exemple #6
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            Page.Validate("vgPrimaryAdd");
            if (Page.IsValid)
            {
                var tran = (from tr in db.GCTransactions
                            where tr.GCNumber == Request.QueryString["gcId"]
                            select tr).FirstOrDefault();


                tran.Remarks = txtRemarks.Text;
                tran.GCType  = ddlGCType.SelectedValue;
                if (txtExpirationDate.Text != String.Empty)
                {
                    tran.ExpirationDate = Convert.ToDateTime(txtExpirationDate.Text);
                }
                else
                {
                    tran.ExpirationDate = null;
                }

                if (txtCheckin.Text != String.Empty)
                {
                    tran.CheckinDate = Convert.ToDateTime(txtCheckin.Text);
                }
                else
                {
                    tran.CheckinDate = null;
                }

                if (txtCheckout.Text != String.Empty)
                {
                    tran.CheckoutDate = Convert.ToDateTime(txtCheckout.Text);
                }
                else
                {
                    tran.CheckoutDate = null;
                }

                if (ddlGCStatus.SelectedValue != "")
                {
                    tran.StatusGC = ddlGCStatus.SelectedValue;
                }

                //chk expiration
                if (tran.StatusGC == "Expired")
                {
                    if (DateTime.Today <= tran.ExpirationDate)
                    {
                        tran.StatusGC = "Waiting";
                    }
                }

                db.SubmitChanges();

                //audit trail
                DBLogger.Log("Update", "Updated GC Number: \n " +
                             "Set Status: " + tran.StatusGC, tran.GCNumber);

                if (ddlGCStatus.SelectedValue == "Cancelled")
                {
                    Javascript.ShowModal(this, this, "cancelledModal");
                }
                else
                {
                    Response.Redirect("~/fo/frontoffice.aspx");
                }
            }
        }