protected void grdAlias_RowDeleting(object sender, GridViewDeleteEventArgs e) { MDMSVC.DC_keyword_alias newAlias = new MDMSVC.DC_keyword_alias { 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_Id = Guid.Parse(hdnKeywordId.Value), KeywordAlias_Id = Guid.Parse(grdAlias.DataKeys[e.RowIndex].Value.ToString()), Status = "INACTIVE", }; UpdateGridView(newAlias); fillkeywordalias(); }
protected void grdAlias_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox txtAlias = (TextBox)grdAlias.Rows[e.RowIndex].FindControl("txtAlias"); TextBox txtAliasSequence = (TextBox)grdAlias.Rows[e.RowIndex].FindControl("txtAliasSequence"); MDMSVC.DC_keyword_alias newAlias = new MDMSVC.DC_keyword_alias { 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_Id = Guid.Parse(hdnKeywordId.Value), KeywordAlias_Id = Guid.Parse(grdAlias.DataKeys[e.RowIndex].Value.ToString()), Value = txtAlias.Text, Status = "ACTIVE", Sequence = Convert.ToInt32(txtAliasSequence.Text) }; UpdateGridView(newAlias); grdAlias.EditIndex = -1; fillkeywordalias(); }
protected void grdAlias_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "AddNew") { TextBox txtAlias = (TextBox)grdAlias.HeaderRow.FindControl("txtAlias"); TextBox txtAliasSequence = (TextBox)grdAlias.HeaderRow.FindControl("txtAliasSequence"); MDMSVC.DC_keyword_alias newAlias = new MDMSVC.DC_keyword_alias { 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_Id = Guid.Parse(hdnKeywordId.Value), KeywordAlias_Id = Guid.Parse(e.CommandArgument.ToString()), Value = txtAlias.Text, Status = "ACTIVE", Sequence = Convert.ToInt32(txtAliasSequence.Text) }; UpdateGridView(newAlias); fillkeywordalias(); } else if (e.CommandName == "UnDelete") { MDMSVC.DC_keyword_alias newAlias = new MDMSVC.DC_keyword_alias { 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_Id = Guid.Parse(hdnKeywordId.Value), KeywordAlias_Id = Guid.Parse(e.CommandArgument.ToString()), Status = "ACTIVE" }; UpdateGridView(newAlias); fillkeywordalias(); } }
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); }