Beispiel #1
0
        protected void BtnEdit_Command(object sender, CommandEventArgs e)
        {
            int subSectorId = 0;

            if (e.CommandName == "edit")
            {
                subSectorId = int.Parse(e.CommandArgument.ToString());
                SecureQueryString str = new SecureQueryString();
                str["id"] = e.CommandArgument.ToString();
                Response.Redirect(Constants.ConstantAppPath + "/Modules/SectorManagement/AddEditSubSector.aspx" + str.EncryptedString, false);
            }
            else if (e.CommandName == "delete")
            {
                objComSubSector             = new ComSubSector();
                objComSubSector.SubSectorId = int.Parse(e.CommandArgument.ToString());
                objComSubSector.Mode        = "D";
                objWebService = new SectorService();
                objWebService.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationSector();
                objWebService.AddSubSector(objComSubSector);
                Response.Redirect(Constants.ConstantAppPath + "/Modules/SectorManagement/ListSubSector.aspx");
            }
            else if (e.CommandName == "lock")
            {
                int i = 0;
                objComSubSector             = new ComSubSector();
                objComSubSector.SubSectorId = int.Parse(e.CommandArgument.ToString());
                objComSubSector.Mode        = "L";
                objWebService = new SectorService();
                objWebService.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationSector();
                i = objWebService.AddSubSector(objComSubSector);
                if (i > 0)
                {
                    Response.Redirect(Constants.ConstantAppPath + "/Modules/SectorManagement/ListSubSector.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Lock failed')</script>");
                }
            }
            else
            {
                int i = 0;
                objComSubSector             = new ComSubSector();
                objComSubSector.SubSectorId = int.Parse(e.CommandArgument.ToString());
                objComSubSector.Mode        = "L";
                objWebService = new SectorService();
                objWebService.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationSector();
                i = objWebService.AddSubSector(objComSubSector);
                if (i > 0)
                {
                    Response.Redirect(Constants.ConstantAppPath + "/Modules/SectorManagement/ListSubSector.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Unlock failed')</script>");
                }
            }
        }
        protected void btnAddSubSector_Click(object sender, EventArgs e)
        {
            int i = 0;

            objComSubSector = new ComSubSector();
            objComSubSector.SubSectorEngName = txtSubSectorEngName.Text;
            objComSubSector.SubSectorNepName = txtSubSectorNepName.Text;
            objComSubSector.SubSectorCode    = txtSubSectorCode.Text;
            objComSubSector.SectorId         = ddlSector.SelectedValue.ToInt32();
            objComSubSector.SubSectorId      = Session["subSectorId"].ToInt32();
            objComSubSector.Islocked         = 0;
            if (chkIsEnable.Checked == true)
            {
                objComSubSector.Isenable = 1;
            }
            else
            {
                objComSubSector.Isenable = 0;
            }
            objComSubSector.Lang = Session["LanguageSetting"].ToString();
            if (Session["subSectorId"].ToInt32() == 0)
            {
                objComSubSector.Mode = "I";
            }
            else
            {
                objComSubSector.Mode = "U";
            }
            objWebService = new SectorService();
            objWebService.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationSector();

            i = objWebService.AddSubSector(objComSubSector);
            if (i > 0)
            {
                Response.Write("<script>alert('Sub Sector added successfully!')</script>");
                Response.Redirect(Constants.ConstantAppPath + "/Modules/SectorManagement/ListSubSector.aspx");
            }
            else
            {
                Response.Write("<script>alert('Sub Sector addition failed!')</script>");
            }
        }