Example #1
0
        public ActionResult OprFileManager(string id = "")
        {
            var istdate = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, TimeZoneInfo.Local.Id, "India Standard Time");

            ManageCompMaster  companyMaster = new ManageCompMaster();
            fileManagerAdd    objmodel      = new fileManagerAdd();
            ManageFileManager filemanager   = new ManageFileManager();

            if (id == "")
            {
                var companyList = companyMaster.compmastersListByCustId(ProjectSession.custid);
                ViewBag.CompanyList = new SelectList(companyList, "compid", "compname");

                var categoryList = filemanager.GetFileCategory();
                ViewBag.CategoryList = new SelectList(categoryList, "catid", "catname");

                objmodel.uploadeddateString = istdate.ToString("dd/MM/yyyy");
                objmodel.filedateString     = istdate.ToString("dd/MM/yyyy");
            }
            else
            {
                var fileMData   = filemanager.GetFileManagerById(id, ProjectSession.custid);
                var fileDetails = filemanager.GetFileDetailsById(fileMData.fileid, ProjectSession.custid);
                objmodel.fileid             = fileMData.fileid;
                objmodel.fileid1            = fileMData.fileid1.Value;
                objmodel.compid             = fileMData.compid;
                objmodel.compfinid          = fileMData.compfinid;
                objmodel.filecatid          = fileMData.filecatid;
                objmodel.filesubcatid       = fileMData.filesubcatid;
                objmodel.filetitle          = fileMData.filetitle;
                objmodel.filedate           = fileMData.filedate;
                objmodel.uploadeddateString = fileMData.uploadeddate.Value.ToShortDateString();
                objmodel.filedateString     = fileMData.filedate.Value.ToShortDateString();
                objmodel.uploadeddate       = fileMData.uploadeddate.Value;
                objmodel.filedescr          = fileMData.filedescr;
                objmodel.filemanagerdtl     = filemanager.GetFileDetailsById(fileMData.fileid, ProjectSession.custid);


                //objmodel.filedtlid = fileDetails.filedtlid;
                //objmodel.fileimageSaved = fileDetails.fileimage;
                //objmodel.filetype = fileDetails.filetype;
                //objmodel.filename = fileDetails.filename;
                //objmodel.filedtlid1 = fileDetails.filedtlid1.Value;
                //  var imagetype = objmodel.filetype.Substring(1, objmodel.filetype.Length - 1);

                var companyList = companyMaster.compmastersListByCustId(ProjectSession.custid);
                ViewBag.CompanyList = new SelectList(companyList, "compid", "compname", objmodel.compid);

                var categoryList = filemanager.GetFileCategory();
                ViewBag.CategoryList = new SelectList(categoryList, "catid", "catname", objmodel.filecatid);

                //ViewBag.Base64String = "data:image/"+imagetype +";base64," + Convert.ToBase64String(objmodel.fileimageSaved, 0, objmodel.fileimageSaved.Length);
            }
            return(View(objmodel));
        }
Example #2
0
        public ActionResult ViewCompList()
        {
            try
            {
                ManageCompMaster compmst = new ManageCompMaster();
                ViewBag.CompList = compmst.compmastersList;

                return(View());
            }
            catch
            {
                ViewBag.Error = "Sorry, Problem in getting Staff list";
            }
            return(View());
        }
Example #3
0
        public ActionResult formcompmaster(Models.compmastermodel compmst)
        {
            ManageCompMaster mngcompmst = new ManageCompMaster();

            if (ModelState.IsValid)
            {
                if (Convert.ToString(compmst.compid) == "")
                {
                    mngcompmst.AddNewEvent(compmst.compid, compmst.compid1, compmst.compcode, compmst.compname,
                                           compmst.compaddr1, compmst.compaddr2, compmst.compaddr3, compmst.compcity, compmst.compzip, compmst.compstate,
                                           compmst.compcontry, compmst.compstdcode, compmst.compphone, compmst.compmobile1, compmst.compmobile2, compmst.compweb,
                                           compmst.compemail, compmst.compstatecode, compmst.compgstno, compmst.comppanno, 0, ProjectSession.custid, compmst.area,
                                           compmst.tanno, compmst.regdate, compmst.regno, compmst.faxno);
                }
                else
                {
                    mngcompmst.UpdateEvent(compmst.compid, compmst.compid1, compmst.compcode, compmst.compname,
                                           compmst.compaddr1, compmst.compaddr2, compmst.compaddr3, compmst.compcity, compmst.compzip, compmst.compstate,
                                           compmst.compcontry, compmst.compstdcode, compmst.compphone, compmst.compmobile1, compmst.compmobile2, compmst.compweb,
                                           compmst.compemail, compmst.compstatecode, compmst.compgstno, compmst.comppanno, 0, ProjectSession.custid, compmst.area,
                                           compmst.tanno, compmst.regdate, compmst.regno, compmst.faxno);
                }
                return(RedirectToAction("ViewCompList"));
            }
            else
            {
                if (!ModelState.IsValid)
                {
                    var modelErrors = new List <string>();
                    foreach (var modelState in ModelState.Values)
                    {
                        foreach (var modelError in modelState.Errors)
                        {
                            modelErrors.Add(modelError.ErrorMessage);
                        }
                    }
                    // do something with the error list :)
                }

                ViewBag.Error             = "Something .";
                TempData["DangerMessage"] = "Something wrong while save data.";
                return(View(compmst));
            }
        }
Example #4
0
        public ActionResult formcompmaster(string id = "")
        {
            compmastermodel  objcom  = new compmastermodel();
            ManageCompMaster compmst = new ManageCompMaster();


            if (Convert.ToString(id) != "")
            {
                compmaster compmast = compmst.GetCompMasterbyId(id, ProjectSession.custid);
                objcom = new compmastermodel(compmast);
            }
            else
            {
                ViewBag.CompList = compmst.compmastersList;
                var count = ViewBag.CompList.Count;

                if (Convert.ToInt32(count) >= Convert.ToInt32(ProjectSession.nocompactive))
                {
                    TempData["DangerMessage"] = "Can not create more company. Kindly contact your administrator.";
                    return(RedirectToAction("ViewCompList"));
                }
            }
            return(View(objcom));
        }
Example #5
0
        public ActionResult OprFileManager(fileManagerAdd obj, HttpPostedFileBase[] fileimages)
        {
            if (string.IsNullOrEmpty(obj.fileid))
            {
                if (!(fileimages.Length > 0))
                {
                    ModelState.AddModelError("fileImage", "Please Select Image");
                }
            }
            if (ModelState.IsValid)
            {
                filemanager       fm          = new filemanager();
                filemanagerdtl    fldtl       = new filemanagerdtl();
                ManageFileManager filemanager = new ManageFileManager();
                fm.filetitle    = obj.filetitle;
                fm.filecatid    = obj.filecatid;
                fm.filesubcatid = obj.filesubcatid;
                fm.filedate     = obj.filedate;
                fm.uploadeddate = obj.uploadeddate;
                fm.filedescr    = obj.filedescr;
                //fm.syncflg
                fm.custid       = ProjectSession.custid;
                fm.addedby      = "0";
                fm.editedby     = "0";
                fm.adddatetime  = DateTime.Now;
                fm.editdatetime = DateTime.Now;
                fm.compid       = obj.compid;
                fm.compfinid    = obj.compfinid;

                if (string.IsNullOrEmpty(obj.fileid))
                {
                    long fileId = filemanager.GetLastFileId() + 1;
                    fm.fileid1  = fileId;
                    fm.fileid   = ProjectSession.custid + "-" + fileId.ToString("0000");
                    fm.filecode = fileId.ToString();
                    filemanager.AddFile(fm);
                }
                else
                {
                    fm.fileid   = obj.fileid;
                    fm.fileid1  = obj.filedtlid1;
                    fm.filecode = obj.fileid1.ToString();
                    filemanager.UpdateFile(fm);
                }

                // if (fileimage != null && fileimage.ContentLength > 0)
                foreach (HttpPostedFileBase fileimage in fileimages)

                {
                    byte[] bytes;
                    using (BinaryReader br = new BinaryReader(fileimage.InputStream))
                    {
                        bytes = br.ReadBytes(fileimage.ContentLength);
                    }
                    string ContentType = fileimage.ContentType;
                    string typ         = ContentType.Split('/')[1];
                    fldtl.addedby   = "0";
                    fldtl.fileid    = fm.fileid;
                    fldtl.custid    = ProjectSession.custid;
                    fldtl.fileimage = bytes;
                    fldtl.filetype  = "." + typ;


                    long filedtlId = 0;
                    if (string.IsNullOrEmpty(obj.filedtlid))
                    {
                        filedtlId         = filemanager.GetLastFiledtlId() + 1;
                        fldtl.filedtlid   = ProjectSession.custid + "-" + filedtlId.ToString("0000");
                        fldtl.filedtlid1  = filedtlId;
                        fldtl.adddatetime = DateTime.Now;
                        fldtl.filename    = filedtlId + "." + typ;
                        filemanager.AddFiledtl(fldtl);
                    }
                    else
                    {
                        fldtl.filedtlid  = obj.filedtlid;;
                        fldtl.filedtlid1 = obj.filedtlid1;
                        fldtl.filename   = obj.filedtlid + "." + typ;
                        filemanager.UpdateFiledtl(fldtl);
                    }
                }
                return(RedirectToAction("ViewFileManagerList"));
            }
            ManageCompMaster  companyMaster = new ManageCompMaster();
            ManageFileManager filemanager1  = new ManageFileManager();

            var companyList = companyMaster.compmastersListByCustId(ProjectSession.custid);

            ViewBag.CompanyList = new SelectList(companyList, "compid", "compname", obj.compid);

            var categoryList = filemanager1.GetFileCategory();

            ViewBag.CategoryList = new SelectList(categoryList, "catid", "catname", obj.filecatid);

            obj.uploadeddateString = DateTime.Now.ToShortDateString();
            obj.filedateString     = obj.filedate.Value.ToShortDateString();

            return(View(obj));
        }