Exemplo n.º 1
0
        private void uploadFiles()
        {
            HttpFileCollection hfc     = Request.Files;
            BLL_Dml            _objbll = new BLL_Dml();
            _database          _objdb  = new _database();

            _objdb.DBName = "DB_" + lblprj.Text;
            _clscmsdocument _objcls = new _clscmsdocument();
            string          _dir    = lblprj.Text;
            bool            _exist  = false;

            if (Directory.Exists(Server.MapPath("CMS_DOCS") + "\\" + _dir) == false)
            {
                Directory.CreateDirectory(Server.MapPath("CMS_DOCS") + "\\" + _dir);
            }
            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf       = hfc[i];
                string         _fileName = System.IO.Path.GetFileName(hpf.FileName);
                if (ChekSpecialCharacter(_fileName) == true)
                {
                    return;
                }
                //FileInfo _Ffile = new FileInfo(Server.MapPath("CMS_DOCS\\" + _dir) + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                //if (_Ffile.Exists == true)
                //    _Ffile.Delete();
                if (hpf.ContentLength > 0)
                {
                    hpf.SaveAs(Server.MapPath("CMS_DOCS") + "\\" + _dir + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                    //hpf.SaveAs("http://www.cmltechniques.com\\CmsDocs\\" + System.IO.Path.GetFileName(hpf.FileName));                          }
                    _objcls.doc_name     = txtdoc_name.Text;
                    _objcls.file_name    = System.IO.Path.GetFileName(hpf.FileName);
                    _objcls.module_name  = (string)Session["mod_name"];
                    _objcls.uid          = (string)Session["uid"];
                    _objcls.project_code = lblprj.Text;
                    _objcls.upload_date  = DateTime.Now;
                    _objcls.folder       = Convert.ToInt32(Session["Fold_cms"]);//Convert.ToInt32(lbldiv.Text);
                    _objcls.module       = Convert.ToInt32(lblM_id_cms.Text);
                    _objcls.reff_no      = lblreff_no.Text;
                    //_objcls.srv_id = Convert.ToInt32((string)Session["ser_name"]);
                    _objcls.srv_id     = Convert.ToInt32(ViewState["ServiceID"]);
                    _objcls.Type       = "Public";
                    _objcls.Comment_By = Convert.ToInt32(dr_responseBy.SelectedItem.Value);
                    _objcls.doc_status = dr_status.SelectedItem.Text;

                    _objbll.Add_CMS_Document(_objcls, _objdb);
                    Set_CommentsBy();
                    _exist = true;
                    //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('Documents Uploaded!');", true);
                }
            }
            //if (chk.Checked == false)
            //    Send_Email();
            if (chk.Checked == false && _exist == true)
            {
                btnDummy_ModalPopupExtender2.Show();
            }
            txtdoc_name.Text = "";
        }
Exemplo n.º 2
0
        private void uploadFiles()
        {
            HttpFileCollection hfc     = Request.Files;
            BLL_Dml            _objbll = new BLL_Dml();
            _database          _objdb  = new _database();

            _objdb.DBName = "DB_" + lblprj.Text;
            _clscmsdocument _objcls = new _clscmsdocument();
            string          _dir    = lblprj.Text;

            if (Directory.Exists(Server.MapPath("../CMS_DOCS") + "\\" + _dir) == false)
            {
                Directory.CreateDirectory(Server.MapPath("../CMS_DOCS") + "\\" + _dir);
            }
            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf       = hfc[i];
                string         _fileName = System.IO.Path.GetFileName(hpf.FileName);
                if (ChekSpecialCharacter(_fileName) == true)
                {
                    return;
                }
                //FileInfo _Ffile = new FileInfo(Server.MapPath("CMS_DOCS\\" + _dir) + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                //if (_Ffile.Exists == true)
                //    _Ffile.Delete();
                if (hpf.ContentLength > 0)
                {
                    hpf.SaveAs(Server.MapPath("../CMS_DOCS") + "\\" + _dir + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                    //hpf.SaveAs("http://www.cmltechniques.com\\CmsDocs\\" + System.IO.Path.GetFileName(hpf.FileName));                          }
                    _objcls.doc_name     = txtdoc_name.Text;
                    _objcls.file_name    = System.IO.Path.GetFileName(hpf.FileName);
                    _objcls.module_name  = lblmod.Text;
                    _objcls.uid          = (string)Session["uid"];
                    _objcls.project_code = lblprj.Text;
                    _objcls.upload_date  = DateTime.Now;
                    _objcls.folder       = 0;
                    _objcls.module       = 0;
                    _objcls.reff_no      = lblmod.Text + "/" + lblid.Text;
                    _objcls.srv_id       = Convert.ToInt32((string)Session["ser_name"]);
                    _objcls.Type         = "Public";
                    _objcls.Comment_By   = 0;
                    _objcls.doc_status   = dr_status.SelectedItem.Text;
                    _objbll.Add_CMS_Document(_objcls, _objdb);
                    //Set_CommentsBy();
                    ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('Documents Uploaded!');", true);
                }
            }
            txtdoc_name.Text = "";


            if (lblprj.Text == "HMIM")
            {
                Response.Redirect("MonthlyReport.aspx?" + Request.QueryString.ToString());
            }
        }