Пример #1
0
        public JsonResult Edit(Sentinta Sentinta)
        {
            response toReturn = new response(true, "", null, null, new List <Error>());

            string conStr          = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]);

            if (Sentinta.ID == null) // insert
            {
                Sentinta       p   = new Sentinta(_CURENT_USER_ID, conStr);
                PropertyInfo[] pis = Sentinta.GetType().GetProperties();
                foreach (PropertyInfo pi in pis)
                {
                    pi.SetValue(p, pi.GetValue(Sentinta));
                }
                toReturn = p.Insert();
            }
            else //
            {
                Sentinta p = new Sentinta(_CURENT_USER_ID, conStr, Convert.ToInt32(Sentinta.ID));
                string   s = JsonConvert.SerializeObject(Sentinta, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = CommonFunctions.DATE_FORMAT
                });
                toReturn = p.Update(s);
            }
            return(Json(toReturn, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        //[AuthorizeUser(ActionName = "Dosare", Recursive = false)]
        public JsonResult ImportSedintaPortal(int IdSedintaPortal, ProcesStadiu ProcesStadiu, Sentinta Sentinta)
        {
            response r      = new response();
            string   conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int      uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);

            if (Sentinta.NR_SENTINTA != null && Sentinta.DATA_SENTINTA != null)
            {
                Sentinta       s    = new Sentinta(uid, conStr);
                PropertyInfo[] pis1 = Sentinta.GetType().GetProperties();
                foreach (PropertyInfo pi in pis1)
                {
                    pi.SetValue(s, pi.GetValue(Sentinta));
                }
                r = s.Insert();
                if (r.Status)
                {
                    ProcesStadiu.ID_SENTINTA = r.InsertedId;
                }
            }
            ProcesStadiu ps = new ProcesStadiu(uid, conStr);

            PropertyInfo[] pis = ProcesStadiu.GetType().GetProperties();
            foreach (PropertyInfo pi in pis)
            {
                pi.SetValue(ps, pi.GetValue(ProcesStadiu));
            }
            r = ps.Insert();
            if (r.Status)
            {
                try
                {
                    SedintaPortal sp = new SedintaPortal(uid, conStr, IdSedintaPortal);
                    sp.Delete();
                }
                catch (Exception exp) { LogWriter.Log(exp); }
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }