Ejemplo n.º 1
0
        protected void frmCityAreaLocation_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            TextBox txtCityAreaName = (TextBox)frmCityAreaLocation.FindControl("txtCityAreaName");
            TextBox txtCityAreaCode = (TextBox)frmCityAreaLocation.FindControl("txtCityAreaCode");

            MDMSVC.DC_CityAreaLocation obj = new MDMSVC.DC_CityAreaLocation();
            obj.City_Id     = Guid.Parse(Convert.ToString(Request.QueryString["City_Id"]));
            obj.Name        = txtCityAreaName.Text.Trim();
            obj.Code        = txtCityAreaCode.Text.Trim();
            obj.CityArea_Id = Guid.Parse(Convert.ToString(grdCityAreas.SelectedDataKey.Value));


            switch (Convert.ToString(e.CommandName))
            {
            case "Add":
            {
                obj.CityAreaLocation_Id = Guid.NewGuid();

                obj.Option = "SAVE";
                _objMasterData.SaveCityAreaLocation(obj);
                fillCityAreaLocation(Convert.ToString(grdCityAreas.SelectedDataKey["CityArea_Id"]));
                txtCityAreaName.Text = "";
                txtCityAreaCode.Text = "";
                frmCityAreaLocation.ChangeMode(FormViewMode.Insert);
                dvMsgCity.Visible = false;
            };
                break;

            case "Save":
            {
                obj.CityAreaLocation_Id = Guid.Parse(Convert.ToString(grdCityAreaLocation.SelectedDataKey.Value));
                obj.Option = "UPDATE";
                _objMasterData.SaveCityAreaLocation(obj);

                fillCityAreaLocation(Convert.ToString(grdCityAreas.SelectedDataKey["CityArea_Id"]));
                txtCityAreaName.Text = "";
                txtCityAreaCode.Text = "";
                frmCityAreaLocation.ChangeMode(FormViewMode.Insert);
                dvMsgCity.Visible = false;
            };
                break;
            }
        }