Beispiel #1
0
        public JsonResult PostExcelFile()
        {
            string             conStr    = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            HttpPostedFileBase f         = Request.Files[0];
            string             initFName = f.FileName;
            string             extension = f.FileName.Substring(f.FileName.LastIndexOf('.'));
            string             newFName  = Guid.NewGuid() + extension;

            Request.Files[0].SaveAs(System.IO.Path.Combine(CommonFunctions.GetImportsFolder(), newFName));
            PlatiRepository pr = new PlatiRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            response        r  = pr.GetPlatiFromExcel("Sheet1", newFName);
            bool            societateDiferita = false;

            foreach (object[] o in (object[])r.Result)
            {
                if (((PlataExtended)o[1]).Dosar.ID_SOCIETATE_CASCO != Convert.ToInt32(Session["ID_SOCIETATE"])) // se incearca incarcarea pt. alta societate decat cea a utilizatorului curent
                {
                    societateDiferita = true;
                    break;
                }
            }
            if (societateDiferita)
            {
                response toReturn = new response(false, String.Format("Nu puteti incarca plati pentru alta societate decat cea curenta ({0})!", ((SocietateAsigurare)Session["SOCIETATE_ASIGURARE"]).DENUMIRE), null, null, null);
                return(Json(toReturn, JsonRequestBehavior.AllowGet));
            }
            r = pr.ImportPlatiDirect("Sheet1", newFName, 0); // 0 = import manual
            JsonResult result = Json(r, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = Int32.MaxValue;
            return(result);
        }
Beispiel #2
0
        public JsonResult MovePendingToOk(PlataExtended plata)
        {
            string conStr          = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]);
            Plata  p = new Plata(_CURENT_USER_ID, conStr);

            PropertyInfo[] pis = plata.Plata.GetType().GetProperties();
            foreach (PropertyInfo pi in pis)
            {
                pi.SetValue(p, pi.GetValue(plata.Plata)); // ca sa avem un obiect si cu credentiale
            }

            response toReturn = p.UpdateWithErrors();

            if (!toReturn.Status)
            {
                return(Json(toReturn, JsonRequestBehavior.AllowGet));
            }
            toReturn = p.Validare();
            if (!toReturn.Status)
            {
                return(Json(toReturn, JsonRequestBehavior.AllowGet));
            }
            PlatiRepository pr = new PlatiRepository(_CURENT_USER_ID, conStr);

            toReturn = pr.MovePendingToOk(Convert.ToInt32(p.ID));
            return(Json(toReturn, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ImportPlataView(int CURENT_USER_ID, string conStr)
        {
            PlatiRepository pr = new PlatiRepository(CURENT_USER_ID, conStr);

            ImportDates = ((List <string>)pr.GetImportDates().Result).ToArray();
            SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(CURENT_USER_ID, conStr);

            this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
        }
Beispiel #4
0
        public JsonResult GetPlatiFromLog(DateTime?ImportDate)
        {
            string          conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            PlatiRepository pr     = new PlatiRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            response        r      = pr.GetPlatiFromLog(ImportDate);
            JsonResult      result = Json(r, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = Int32.MaxValue;
            return(result);
        }