Beispiel #1
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Mode == "New")
            {
                #region Validate



                #endregion

                // Datos de nodo / Empresa / Sede
                NodeOrganizationLoactionWarehouseList objNodeOrgLocaWarehouse = new NodeOrganizationLoactionWarehouseList();
                objNodeOrgLocaWarehouse.i_NodeId         = NodeId;
                objNodeOrgLocaWarehouse.v_OrganizationId = ddlOrganization.SelectedValue;
                objNodeOrgLocaWarehouse.v_LocationId     = ddlLocation.SelectedValue;

                // Datos de Almacén

                var objInsertWarehouseList = InsertWarehouse();

                OperationResult objOperationResult1 = new OperationResult();
                // Graba Nodo / Empresa / Sede / Almacén
                _objNodeBL.AddNodeOrganizationLoactionWarehouse(ref objOperationResult1, objNodeOrgLocaWarehouse, objInsertWarehouseList, ((ClientSession)Session["objClientSession"]).GetAsList());

                if (objOperationResult1.ErrorMessage != null)
                {
                    Alert.ShowInTop(objOperationResult1.ErrorMessage);
                    return;
                }

                if (objOperationResult1.Success != 1)
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult1.ExceptionMessage);
                }
            }
            else if (Mode == "Edit")
            {
                NodeOrganizationLoactionWarehouseList objNodeOrgLocaWarehouse = new NodeOrganizationLoactionWarehouseList();
                objNodeOrgLocaWarehouse.i_NodeId         = NodeId;
                objNodeOrgLocaWarehouse.v_OrganizationId = ddlOrganization.SelectedValue;
                objNodeOrgLocaWarehouse.v_LocationId     = ddlLocation.SelectedValue;

                OperationResult objOperationResult2    = new OperationResult();
                var             objAddWarehouseList    = UpdateWarehouse();
                var             objDeleteWarehouseList = DeleteWarehouse();

                _objNodeBL.UpdateNodeOrganizationLoactionWarehouse(ref objOperationResult2,
                                                                   objNodeOrgLocaWarehouse,
                                                                   objAddWarehouseList,
                                                                   objDeleteWarehouseList,
                                                                   ((ClientSession)Session["objClientSession"]).GetAsList());

                if (objOperationResult2.ErrorMessage != null)
                {
                    Alert.ShowInTop(objOperationResult2.ErrorMessage);
                    return;
                }
            }

            // Cerrar página actual y hacer postback en el padre para actualizar
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }