Exemplo n.º 1
0
        public bool UpdateHotelRule(MDMSVC.DC_Accommodation_RuleInfo AF)
        {
            object result = null;

            ServiceConnection.MDMSvcProxy.PostData(ConfigurationManager.AppSettings["Accomodation_UpdateHotelRulesURI"], AF, typeof(DC_Accommodation_RuleInfo), typeof(bool), out result);
            return((bool)result);
        }
Exemplo n.º 2
0
        protected void frmRule_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            DropDownList ddlRuleName   = (DropDownList)frmRule.FindControl("ddlRuleName");
            TextBox      txtRuleText   = (TextBox)frmRule.FindControl("txtRuleText");
            CheckBox     chkIsInternal = (CheckBox)frmRule.FindControl("chkIsInternal");

            if (e.CommandName.ToString() == "Add")
            {
                TLGX_Consumer.MDMSVC.DC_Accommodation_RuleInfo newObj = new MDMSVC.DC_Accommodation_RuleInfo
                {
                    Accommodation_RuleInfo_Id = Guid.NewGuid(),
                    Accommodation_Id          = Guid.Parse(Request.QueryString["Hotel_Id"]),
                    Create_Date = DateTime.Now,
                    Create_User = System.Web.HttpContext.Current.User.Identity.Name,
                    Description = txtRuleText.Text.Trim(),
                    RuleType    = ddlRuleName.SelectedItem.Text.Trim(),
                    IsActive    = true
                };
                if (chkIsInternal.Checked)
                {
                    newObj.IsInternal = true;
                }
                else
                {
                    newObj.IsInternal = false;
                }
                if (AccSvc.AddHotelRule(newObj))
                {
                    BindHotelRules();

                    frmRule.DataBind();
                    frmRule.ChangeMode(FormViewMode.Insert);

                    GetLookUpValues();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Rule has been added successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                }
            }


            if (e.CommandName.ToString() == "Modify")
            {
                Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                Guid myRow_Id = Guid.Parse(grdHOtelRUles.SelectedDataKey.Value.ToString());

                var result = AccSvc.GetHotelRuleDetails(Accomodation_ID, myRow_Id);

                if (result.Count > 0)
                {
                    TLGX_Consumer.MDMSVC.DC_Accommodation_RuleInfo newObj = new MDMSVC.DC_Accommodation_RuleInfo
                    {
                        Accommodation_RuleInfo_Id = myRow_Id,
                        Accommodation_Id          = Guid.Parse(Request.QueryString["Hotel_Id"]),
                        Edit_Date   = DateTime.Now,
                        Edit_User   = System.Web.HttpContext.Current.User.Identity.Name,
                        Description = txtRuleText.Text.Trim(),
                        RuleType    = ddlRuleName.SelectedItem.Text.Trim(),
                        IsActive    = true
                    };
                    if (chkIsInternal.Checked)
                    {
                        newObj.IsInternal = true;
                    }
                    else
                    {
                        newObj.IsInternal = false;
                    }

                    if (AccSvc.UpdateHotelRule(newObj))
                    {
                        BindHotelRules();

                        frmRule.ChangeMode(FormViewMode.Insert);
                        frmRule.DataBind();

                        GetLookUpValues();
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Rule has been updated successfully", BootstrapAlertType.Success);
                    }
                    else
                    {
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                    }
                }
            }
            ;
        }
Exemplo n.º 3
0
        protected void grdHOtelRUles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Guid        myRow_Id = Guid.Parse(e.CommandArgument.ToString());
            GridViewRow row      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         index    = row.RowIndex;

            if (e.CommandName.ToString() == "Select")
            {
                dvMsg.Style.Add("display", "none");
                Accomodation_ID = Guid.Parse(Request.QueryString["Hotel_Id"]);

                frmRule.ChangeMode(FormViewMode.Edit);
                frmRule.DataSource = AccSvc.GetHotelRuleDetails(Accomodation_ID, myRow_Id);
                frmRule.DataBind();


                GetLookUpValues();

                DropDownList ddlRuleName   = (DropDownList)frmRule.FindControl("ddlRuleName");
                CheckBox     chkIsInternal = (CheckBox)frmRule.FindControl("chkIsInternal");

                MDMSVC.DC_Accommodation_RuleInfo rowView = (MDMSVC.DC_Accommodation_RuleInfo)frmRule.DataItem;

                if (ddlRuleName.Items.Count > 1) // needs to be 1 to handle the "Select" value
                {
                    ddlRuleName.SelectedIndex = ddlRuleName.Items.IndexOf(ddlRuleName.Items.FindByText(rowView.RuleType.ToString()));
                }
                chkIsInternal.Checked = rowView.IsInternal;
            }

            else if (e.CommandName.ToString() == "SoftDelete")
            {
                TLGX_Consumer.MDMSVC.DC_Accommodation_RuleInfo newObj = new MDMSVC.DC_Accommodation_RuleInfo
                {
                    Accommodation_RuleInfo_Id = myRow_Id,
                    IsActive  = false,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateHotelRule(newObj))
                {
                    BindHotelRules();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Rule has been deleted successfully", BootstrapAlertType.Success);
                }
                ;
            }

            else if (e.CommandName.ToString() == "UnDelete")
            {
                TLGX_Consumer.MDMSVC.DC_Accommodation_RuleInfo newObj = new MDMSVC.DC_Accommodation_RuleInfo
                {
                    Accommodation_RuleInfo_Id = myRow_Id,
                    IsActive  = true,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateHotelRule(newObj))
                {
                    BindHotelRules();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Rule has been retrived successfully", BootstrapAlertType.Success);
                }
                ;
            }
        }