Exemple #1
0
        protected void btnFactorySave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnFactorySave_Click";

            try {
                int regionID = 0;
                if (ddlFactoryRegion.SelectedItem == null)
                {
                    WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("Please select Region from the list.");
                    throw (warn);
                }
                else
                {
                    if (ddlFactoryRegion.SelectedItem.Text.ToUpper() == "ALL COOP")
                    {
                        WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("Please do not associate factories to the region All Coop.");
                        throw (warn);
                    }
                    regionID = Convert.ToInt32(ddlFactoryRegion.SelectedItem.Value);
                }

                string factories = "";
                foreach (ListItem li in lstFactory.Items)
                {
                    if (li.Selected)
                    {
                        if (factories.Length == 0)
                        {
                            factories = li.Value;
                        }
                        else
                        {
                            factories += "," + li.Value;
                        }
                    }
                }

                WSCSecurity.UserSecurityRegionFactorySave(regionID, factories);
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }