Пример #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        blAdmin   objBL = new blAdmin();
        dlAdmin   objDL = new dlAdmin();
        Utilities ul    = new Utilities();

        if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
        {
            Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
            HttpBrowserCapabilities browse = Request.Browser;

            objBL.UserID        = Session["username"].ToString();
            objBL.Client_ip     = ul.GetClientIpAddress(this.Page);
            objBL.Useragent     = Request.UserAgent.ToString();
            objBL.ClientOS      = Utilities.System_Info(this.Page);
            objBL.ClientBrowser = browse.Browser;

            objBL.Base_department_id = DDL_BaseDepartment.SelectedValue;
            objBL.District_id_ofc    = RTI_DDL_District.SelectedValue;
            objBL.Office_category    = DDL_OfficeCategory.SelectedValue;
            objBL.Office_level_id    = DDL_OfficeLevel.SelectedValue;
            objBL.Office_id          = DDL_Office.SelectedValue;
            objBL.Year_issue         = txtYearOfIssue.Text;
            if (fu_UserManual.HasFile)
            {
                if (txt_file_desc.Text != "")
                {
                    HttpPostedFile file = fu_UserManual.PostedFile;
                    if (file.ContentLength < 20000000)     // 20 MB
                    {
                        if (file.ContentType == "application/pdf" || file.ContentType == "application/x-pdf" ||
                            file.ContentType == "application/x-unknown")
                        {
                            Stream       fs    = file.InputStream;
                            BinaryReader br    = new BinaryReader(fs);
                            byte[]       bytes = br.ReadBytes((Int32)fs.Length);
                            objBL.FileName        = file.FileName;
                            objBL.ContentType     = file.ContentType;
                            objBL.FileData        = bytes;
                            objBL.FileDescription = txt_file_desc.Text;
                        }
                        else
                        {
                            Utilities.MessageBox_UpdatePanel(update1, "Only PDF type File will be accepted");
                            return;
                        }
                    }
                    else
                    {
                        Utilities.MessageBox_UpdatePanel(update1, "Your file size is greater than 2 MB  ");
                        return;
                    }
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(update1, "File Description Is Required");
                    return;
                }
            }
            else
            {
                Utilities.MessageBox_UpdatePanel(update1, "PDF File required");
                return;
            }

            ReturnClass.ReturnBool rb = objDL.Insert_DeptUserManual(objBL);
            if (rb.status == true)
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBox_UpdatePanel(update1, "Action Submitted Successfully");
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(update1, "कार्रवाई सफलतापूर्वक सबमिट की गई");
                }
                //   Utilities.MessageBox_UpdatePanel_Redirect(udp, "Action Submitted Successfully", "../Employee/EmployeeWelcome_Page.aspx");
            }
            else
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBox_UpdatePanel(update1, "Action Not Submitted");
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(update1, "कार्रवाई सबमिट नहीं की गई");
                }
                // Utilities.MessageBox_UpdatePanel(udp, "Action Not Submitted");
            }
            // }  // end of Submit
        }
    } // End of ButtonSubmit click