コード例 #1
0
ファイル: BackLogData.cs プロジェクト: thatvish/RCSHaryana-1
        public int SaveContentFileUpload(ContentFileUploadModel objCFU)
        {
            int i;

            connection.Open();
            using (SqlConnection con = new SqlConnection(ConStr))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("[dbo].[SaveContentUploadsContentForBackLog]", connection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                cmd.Parameters.AddWithValue("@ContentUpload", objCFU.ContentUpload);
                cmd.Parameters.AddWithValue("@FormId", objCFU.FormId);
                cmd.Parameters.AddWithValue("@USER_ID", objCFU.USER_ID);
                cmd.Parameters.AddWithValue("@File_Name", objCFU.File_Name);
                cmd.Parameters.AddWithValue("@SocietyTransID", objCFU.SocietyTransID);
                cmd.Parameters.AddWithValue("@Path", objCFU.Path);
                i = cmd.ExecuteNonQuery();
            }
            connection.Close();
            return(i);
        }
コード例 #2
0
        public ActionResult SocietyMemberDetails(FormCollection fc, IEnumerable <HttpPostedFileBase> files)
        {
            ByeLawsModel           objBL  = new ByeLawsModel();
            ContentFileUploadModel objCFU = new ContentFileUploadModel();

            try
            {
                int i = 4;
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        AttachmentType aa  = new AttachmentType();
                        Stream         str = file.InputStream;
                        objCFU.File_Name  = file.FileName;
                        objBL.ByeLawsName = file.FileName;
                        string       extenstion = "pdf";
                        BinaryReader Br         = new BinaryReader(str);
                        byte[]       FileDet    = Br.ReadBytes((Int32)str.Length);
                        string       base64ImageRepresentation = Convert.ToBase64String(FileDet);
                        objBL.Docs            = base64ImageRepresentation;
                        objCFU.ContentUpload  = base64ImageRepresentation;
                        objBL.SocietyTransID  = Convert.ToString(Session["SocietyTransID"]);
                        objCFU.USER_ID        = Convert.ToInt32(Session["UserId"]);
                        objCFU.SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
                        aa            = GetMimeType(base64ImageRepresentation);
                        objCFU.FormId = i;
                        if (extenstion.IndexOf(aa.Extension.Replace(".", "")) < 0 || aa.Extension == "")
                        {
                        }
                        else
                        {
                            Int64 filesizeallowedfor_FileUpload = 2048 * 5;
                            if (file.ContentLength < filesizeallowedfor_FileUpload)
                            {
                                int a = objSSF.SaveContentFileUpload(objCFU);
                            }
                        }
                    }
                    i = i + 1;
                }
                List <SelectListItem> lstSL   = new List <SelectListItem>();
                List <SelectListItem> lstI    = new List <SelectListItem>();
                InspectorData         objID   = new InspectorData();
                ForwardToARCSOfficers objFTAO = new ForwardToARCSOfficers
                {
                    IncepectorCode = Convert.ToInt32(Session["InsceptorCode"]),
                    SocietyTransId = Convert.ToString(Session["SocietyTransID"]),
                    Remarks        = fc.Get("ARCSRemarks").ToString()
                };
                int result = objID.ForwardToARCS(objFTAO);
                if (result >= 1)
                {
                    ViewBag.show      = "Application successfully forwarded to incepector";
                    ViewBag.result    = "1";
                    ViewBag.tabResult = "1";
                }
                else
                {
                    ViewBag.show      = "Application not successfully forwarded to incepector";
                    ViewBag.result    = "0";
                    ViewBag.tabResult = "0";
                }
                lstSL         = GetSocietyList();
                ViewBag.lstSL = lstSL;
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(View());
        }
コード例 #3
0
        public ActionResult CopyofResolution(IEnumerable <HttpPostedFileBase> files, FormCollection collections)
        {
            try
            {
                ByeLawsModel           objBL  = new ByeLawsModel();
                ContentFileUploadModel objCFU = new ContentFileUploadModel();
                int i = 11;
                lstR                 = GetRelationship();
                lstMember            = GetShareTransferMember();
                lstGD                = GetDistrict();
                ViewBag.Relationship = lstR;
                ViewBag.District     = lstGD;
                ViewBag.MemberDetail = lstMember;
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        AttachmentType aa  = new AttachmentType();
                        Stream         str = file.InputStream;
                        objCFU.File_Name  = file.FileName;
                        objBL.ByeLawsName = file.FileName;
                        string       extenstion = "pdf";
                        BinaryReader Br         = new BinaryReader(str);
                        byte[]       FileDet    = Br.ReadBytes((Int32)str.Length);
                        string       base64ImageRepresentation = Convert.ToBase64String(FileDet);
                        byte[]       data = Encoding.UTF8.GetBytes(base64ImageRepresentation);
                        objBL.Docs            = base64ImageRepresentation;
                        objCFU.ContentUpload  = base64ImageRepresentation;
                        objBL.SocietyTransID  = Convert.ToString(Session["SocietyTransID"]);
                        objCFU.USER_ID        = Convert.ToInt32(Session["UserId"]);
                        objCFU.SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
                        aa            = GetMimeType(base64ImageRepresentation);
                        objCFU.FormId = i;
                        if (extenstion.IndexOf(aa.Extension.Replace(".", "")) < 0 || aa.Extension == "")
                        {
                        }
                        else
                        {
                            decimal size = Math.Round(((decimal)file.ContentLength / (decimal)1024), 2);
                            if (size < 1000)
                            {
                                objCFU.FormId = 11;
                                var    filename      = Path.GetFileNameWithoutExtension(file.FileName);
                                string extensionName = Path.GetExtension(file.FileName);
                                var    fullFile      = filename + GetRandomText() + extensionName;
                                var    dbsavePath    = "/pdf/" + file.FileName;
                                fullFile = Path.Combine(Server.MapPath("~/pdf/"), fullFile);
                                file.SaveAs(fullFile);
                                objCFU.Path = fullFile;
                                int a = objBdata.SaveContentFileUpload(objCFU);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(View("~/Views/BackLog/ShareTransfer.cshtml"));
        }
コード例 #4
0
        public ActionResult UploadFormL(IEnumerable <HttpPostedFileBase> files, FormCollection collections)
        {
            try
            {
                int check = objBdata.CheckFieldStatus(Convert.ToString(Session["SocietyTransID"]));
                if (check == 0)
                {
                    ByeLawsModel           objBL  = new ByeLawsModel();
                    ContentFileUploadModel objCFU = new ContentFileUploadModel();
                    int i = 8;
                    foreach (var file in files)
                    {
                        if (file != null)
                        {
                            AttachmentType aa  = new AttachmentType();
                            Stream         str = file.InputStream;
                            objCFU.File_Name  = file.FileName;
                            objBL.ByeLawsName = file.FileName;
                            string       extenstion = "pdf";
                            BinaryReader Br         = new BinaryReader(str);
                            byte[]       FileDet    = Br.ReadBytes((Int32)str.Length);
                            string       base64ImageRepresentation = Convert.ToBase64String(FileDet);
                            byte[]       data = Encoding.UTF8.GetBytes(base64ImageRepresentation);
                            objBL.Docs            = base64ImageRepresentation;
                            objCFU.ContentUpload  = base64ImageRepresentation;
                            objBL.SocietyTransID  = Convert.ToString(Session["SocietyTransID"]);
                            objCFU.USER_ID        = Convert.ToInt32(Session["UserId"]);
                            objCFU.SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
                            aa            = GetMimeType(base64ImageRepresentation);
                            objCFU.FormId = i;
                            if (extenstion.IndexOf(aa.Extension.Replace(".", "")) < 0 || aa.Extension == "")
                            {
                            }
                            else
                            {
                                decimal size = Math.Round(((decimal)file.ContentLength / (decimal)1024), 2);
                                if (size < 1000)
                                {
                                    if (objCFU.FormId == 5)
                                    {
                                        int a = objBdata.SaveByeLaws(objBL);
                                    }
                                    else
                                    {
                                        objCFU.FormId = 10;
                                        var    filename      = Path.GetFileNameWithoutExtension(file.FileName);
                                        string extensionName = Path.GetExtension(file.FileName);
                                        var    fullFile      = filename + GetRandomText() + extensionName;
                                        var    dbsavePath    = "/pdf/" + file.FileName;
                                        fullFile = Path.Combine(Server.MapPath("~/pdf/"), fullFile);
                                        file.SaveAs(fullFile);
                                        objCFU.Path = fullFile;
                                        int a = objBdata.SaveContentFileUpload(objCFU);
                                    }
                                }
                            }
                        }
                        i = i + 1;
                    }
                    int j = objBdata.GetUploadStatus(objBL.SocietyTransID);
                    if (j == 1)
                    {
                        Session["SocietyStatus"] = 11;
                    }
                }
                else
                {
                    TempData["CheckField"] = "Incomplete";
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(RedirectToAction("BackLogFormL"));
        }