Ejemplo n.º 1
0
        protected void UpdateGridView(MDMSVC.DC_keyword_alias Row)
        {
            Guid Keyword_Id = Guid.Parse(hdnKeywordId.Value);

            string[] EntityFor = chklistEntityFor.Items.Cast <ListItem>().Where(x => x.Selected).Select(s => s.Text).ToArray();

            MDMSVC.DC_Keyword Keyword = new MDMSVC.DC_Keyword
            {
                Attribute   = chkNewKeywordAttribute.Checked,
                Create_Date = DateTime.Now,
                Create_User = System.Web.HttpContext.Current.User.Identity.Name,
                Edit_Date   = DateTime.Now,
                Edit_User   = System.Web.HttpContext.Current.User.Identity.Name,
                Keyword     = txtAddNewKeyword.Text,
                Keyword_Id  = Keyword_Id,
                Sequence    = Convert.ToInt32(txtKeywordSequence.Text),
                Status      = "ACTIVE",
                EntityFor   = string.Join(",", EntityFor),
                Icon        = ddlglyphiconForAttributes.SelectedIndex == 0 ? string.Empty : ddlglyphiconForAttributes.SelectedItem.Text,
            };

            if (Row != null)
            {
                List <MDMSVC.DC_keyword_alias> aliasList = new List <MDMSVC.DC_keyword_alias>();
                aliasList.Add(Row);
                Keyword.Alias = aliasList.ToArray();
            }

            if (chkNewKeywordAttribute.Checked)
            {
                if (ddlAttrType.SelectedIndex != 0)
                {
                    Keyword.AttributeType = ddlAttrType.SelectedItem.Text;
                }
                if (ddlAttrLvl.SelectedIndex != 0)
                {
                    Keyword.AttributeLevel = ddlAttrLvl.SelectedItem.Text;

                    if (Keyword.AttributeLevel == "Room Info")
                    {
                        Keyword.AttributeSubLevel = ddlRoomSchemaLoc.SelectedIndex == 0 ? string.Empty : ddlRoomSchemaLoc.SelectedItem.Text;
                        if (Keyword.AttributeSubLevel == "Room Category")
                        {
                            Keyword.AttributeSubLevelValue = ddlRoomInfo_Category.SelectedIndex == 0 ? string.Empty : ddlRoomInfo_Category.SelectedItem.Text;
                        }
                        else if (Keyword.AttributeSubLevel == "Bed Type")
                        {
                            Keyword.AttributeSubLevelValue = ddlRoomInfo_BedType.SelectedIndex == 0 ? string.Empty : ddlRoomInfo_BedType.SelectedItem.Text;
                        }
                        else if (Keyword.AttributeSubLevel == "Bathroom Type")
                        {
                            Keyword.AttributeSubLevelValue = ddlRoomInfo_BathroomType.SelectedIndex == 0 ? string.Empty : ddlRoomInfo_BathroomType.SelectedItem.Text;
                        }
                        else if (Keyword.AttributeSubLevel == "Smoking")
                        {
                            Keyword.AttributeSubLevelValue = ddlRoomInfo_Smoking.SelectedIndex == 0 ? string.Empty : ddlRoomInfo_Smoking.SelectedItem.Text;
                        }
                        else
                        {
                            Keyword.AttributeSubLevelValue = string.Empty;
                        }
                    }
                    else if (Keyword.AttributeLevel == "Room Amenity")
                    {
                        Keyword.AttributeSubLevel      = ddlAmentityType.SelectedIndex == 0 ? string.Empty : ddlAmentityType.SelectedItem.Text;
                        Keyword.AttributeSubLevelValue = string.Empty;
                    }
                    else
                    {
                        Keyword.AttributeSubLevel      = string.Empty;
                        Keyword.AttributeSubLevelValue = string.Empty;
                    }
                }
            }
            else
            {
                Keyword.AttributeType          = string.Empty;
                Keyword.AttributeLevel         = string.Empty;
                Keyword.AttributeSubLevel      = string.Empty;
                Keyword.AttributeSubLevelValue = string.Empty;
            }

            var result = mappingScv.AddUpdateKeyword(Keyword);

            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "hideshowAttrLvl('" + ddlAttrLvl.ClientID + "')", true);
            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "hideshowAttrLvlRoomSchema('" + ddlRoomSchemaLoc.ClientID + "')", true);

            BootstrapAlert.BootstrapAlertMessage(dvMsgAlias, result.StatusMessage, (BootstrapAlertType)result.StatusCode);
        }
Ejemplo n.º 2
0
        protected void gvSearchResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditKeyWordMgmr")
            {
                dvMsg.InnerText = string.Empty;
                dvMsg.Style.Add("display", "none");

                dvMsgAlias.InnerText = string.Empty;
                dvMsgAlias.Style.Add("display", "none");

                hdnKeywordId.Value = e.CommandArgument.ToString();

                MDMSVC.DC_Keyword_RQ RQParam = new MDMSVC.DC_Keyword_RQ();

                RQParam.Keyword_Id = Guid.Parse(hdnKeywordId.Value);
                RQParam.PageNo     = 0;
                RQParam.PageSize   = 1;

                var result = mappingScv.SearchKeyword(RQParam);

                if (result != null && result.Count > 0)
                {
                    txtAddNewKeyword.Text = result[0].Keyword;

                    dvAttrDetails.Attributes.Remove("class");
                    if (result[0].Attribute ?? false)
                    {
                        dvAttrDetails.Style.Add("display", "block");
                    }
                    else
                    {
                        dvAttrDetails.Style.Add("display", "none");
                    }

                    chkNewKeywordAttribute.Checked = result[0].Attribute ?? false;

                    txtKeywordSequence.Text = result[0].Sequence.ToString();
                    chklistEntityFor.ClearSelection();

                    if (!string.IsNullOrWhiteSpace(result[0].EntityFor))
                    {
                        var EntityFor = result[0].EntityFor.Split(',');
                        for (int count = 0; count < chklistEntityFor.Items.Count; count++)
                        {
                            if (EntityFor.Contains(chklistEntityFor.Items[count].ToString()))
                            {
                                chklistEntityFor.Items[count].Selected = true;
                            }
                        }
                    }

                    ddlShowEntriesAlias.SelectedIndex = 0;
                    ddlglyphiconForAttributes.ClearSelection();
                    //ddlglyphiconForAttributes.SelectedIndex = 0;
                    spanglyphicon.Attributes.Remove("class");

                    if (result[0].Icon != null)
                    {
                        ddlglyphiconForAttributes.ClearSelection();
                        if (!String.IsNullOrWhiteSpace(result[0].Icon))
                        {
                            if (ddlglyphiconForAttributes.Items.FindByText(result[0].Icon) != null)
                            {
                                ddlglyphiconForAttributes.Items.FindByText(result[0].Icon).Selected = true;
                                spanglyphicon.Attributes.Add("class", "glyphicon glyphicon-" + result[0].Icon);
                            }
                        }
                    }

                    ddlAttrType.ClearSelection();
                    //ddlAttrType.SelectedIndex = 0;
                    if (!string.IsNullOrWhiteSpace(result[0].AttributeType))
                    {
                        if (ddlAttrType.Items.FindByText(result[0].AttributeType) != null)
                        {
                            ddlAttrType.Items.FindByText(result[0].AttributeType).Selected = true;
                        }
                    }

                    ddlAttrLvl.ClearSelection();
                    ddlAmentityType.ClearSelection();
                    ddlRoomSchemaLoc.ClearSelection();
                    ddlRoomInfo_BathroomType.ClearSelection();
                    ddlRoomInfo_BedType.ClearSelection();
                    ddlRoomInfo_Category.ClearSelection();
                    ddlRoomInfo_Smoking.ClearSelection();

                    //ddlAttrLvl.SelectedIndex = 0;
                    //ddlAmentityType.SelectedIndex = 0;
                    //ddlRoomSchemaLoc.SelectedIndex = 0;
                    //ddlRoomInfo_BathroomType.SelectedIndex = 0;
                    //ddlRoomInfo_BedType.SelectedIndex = 0;
                    //ddlRoomInfo_Category.SelectedIndex = 0;
                    //ddlRoomInfo_Smoking.SelectedIndex = 0;

                    if (!string.IsNullOrWhiteSpace(result[0].AttributeLevel))
                    {
                        if (ddlAttrLvl.Items.FindByText(result[0].AttributeLevel) != null)
                        {
                            ddlAttrLvl.Items.FindByText(result[0].AttributeLevel).Selected = true;
                        }

                        if (result[0].AttributeLevel == "Room Info")
                        {
                            if (ddlRoomSchemaLoc.Items.FindByText(result[0].AttributeSubLevel) != null)
                            {
                                ddlRoomSchemaLoc.Items.FindByText(result[0].AttributeSubLevel).Selected = true;
                            }

                            if (result[0].AttributeSubLevel == "Room Category")
                            {
                                if (ddlRoomInfo_Category.Items.FindByText(result[0].AttributeSubLevelValue) != null)
                                {
                                    ddlRoomInfo_Category.Items.FindByText(result[0].AttributeSubLevelValue).Selected = true;
                                }
                            }
                            else if (result[0].AttributeSubLevel == "Bed Type")
                            {
                                if (ddlRoomInfo_BedType.Items.FindByText(result[0].AttributeSubLevelValue) != null)
                                {
                                    ddlRoomInfo_BedType.Items.FindByText(result[0].AttributeSubLevelValue).Selected = true;
                                }
                            }
                            else if (result[0].AttributeSubLevel == "Bathroom Type")
                            {
                                if (ddlRoomInfo_BathroomType.Items.FindByText(result[0].AttributeSubLevelValue) != null)
                                {
                                    ddlRoomInfo_BathroomType.Items.FindByText(result[0].AttributeSubLevelValue).Selected = true;
                                }
                            }
                            else if (result[0].AttributeSubLevel == "Smoking")
                            {
                                if (ddlRoomInfo_Smoking.Items.FindByText(result[0].AttributeSubLevelValue) != null)
                                {
                                    ddlRoomInfo_Smoking.Items.FindByText(result[0].AttributeSubLevelValue).Selected = true;
                                }
                            }
                        }
                        else if (result[0].AttributeLevel == "Room Amenity")
                        {
                            if (ddlAmentityType.Items.FindByText(result[0].AttributeSubLevel) != null)
                            {
                                ddlAmentityType.Items.FindByText(result[0].AttributeSubLevel).Selected = true;
                            }
                        }
                    }

                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "hideshowAttrLvl('" + ddlAttrLvl.ClientID + "')", true);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "hideshowAttrLvlRoomSchema('" + ddlRoomSchemaLoc.ClientID + "')", true);

                    AliasPageNo = 0;
                    fillkeywordalias();
                }

                //GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);

                //txtAddNewKeyword.Text = row.Cells[0].Text;
                //chkNewKeywordAttribute.Checked = Convert.ToBoolean(row.Cells[1].Text);
                //txtKeywordSequence.Text = row.Cells[2].Text;
                //chklistEntityFor.ClearSelection();

                //if (!string.IsNullOrWhiteSpace(row.Cells[4].Text))
                //{
                //    var EntityFor = row.Cells[4].Text.Split(',');
                //    for (int count = 0; count < chklistEntityFor.Items.Count; count++)
                //    {
                //        if (EntityFor.Contains(chklistEntityFor.Items[count].ToString()))
                //        {
                //            chklistEntityFor.Items[count].Selected = true;
                //        }
                //    }
                //}

                //AliasPageNo = 0;
                //ddlShowEntriesAlias.SelectedIndex = 0;

                //ddlglyphiconForAttributes.ClearSelection();
                //ddlglyphiconForAttributes.SelectedIndex = 0;
                //spanglyphicon.Attributes.Remove("class");

                //Label lblIconText = (Label)row.FindControl("lblIconText");
                //if (lblIconText != null)
                //{
                //    ddlglyphiconForAttributes.ClearSelection();
                //    if (!String.IsNullOrWhiteSpace(lblIconText.Text))
                //    {
                //        if (ddlglyphiconForAttributes.Items.FindByText(lblIconText.Text) != null)
                //        {
                //            ddlglyphiconForAttributes.Items.FindByText(lblIconText.Text).Selected = true;
                //            spanglyphicon.Attributes.Add("class", "glyphicon glyphicon-" + lblIconText.Text);
                //        }
                //    }

                //}

                //fillkeywordalias();
            }
            else if (e.CommandName == "SoftDelete")
            {
                dvMsgAlias.InnerText = string.Empty;
                dvMsgAlias.Style.Add("display", "none");

                Guid Keyword_Id           = Guid.Parse(e.CommandArgument.ToString());
                MDMSVC.DC_Keyword Keyword = new MDMSVC.DC_Keyword
                {
                    Edit_Date  = DateTime.Now,
                    Edit_User  = System.Web.HttpContext.Current.User.Identity.Name,
                    Keyword_Id = Keyword_Id,
                    Status     = "INACTIVE"
                };

                var result = mappingScv.AddUpdateKeyword(Keyword);
                fillkeyword(Convert.ToInt32(ddlShowEntries.SelectedItem.Text), PageNo);

                BootstrapAlert.BootstrapAlertMessage(dvMsg, result.StatusMessage, (BootstrapAlertType)result.StatusCode);
            }
            else if (e.CommandName == "UnDelete")
            {
                dvMsgAlias.InnerText = string.Empty;
                dvMsgAlias.Style.Add("display", "none");

                Guid Keyword_Id = Guid.Parse(e.CommandArgument.ToString());

                MDMSVC.DC_Keyword Keyword = new MDMSVC.DC_Keyword
                {
                    Edit_Date  = DateTime.Now,
                    Edit_User  = System.Web.HttpContext.Current.User.Identity.Name,
                    Keyword_Id = Keyword_Id,
                    Status     = "ACTIVE"
                };

                var result = mappingScv.AddUpdateKeyword(Keyword);
                fillkeyword(Convert.ToInt32(ddlShowEntries.SelectedItem.Text), PageNo);

                BootstrapAlert.BootstrapAlertMessage(dvMsg, result.StatusMessage, (BootstrapAlertType)result.StatusCode);
            }
        }