Ejemplo n.º 1
0
        public static IEnumerable<PlanServiceIssue> GetClaimList(DateTime month, int? idCity = null, string address=null, int? idClient = null, string serviceAdminSid = null, string serviceEngeneerSid = null)
        {
            SqlParameter pMonth = new SqlParameter() { ParameterName = "date_month", SqlValue = month, SqlDbType = SqlDbType.Date };
            SqlParameter pIdCity = new SqlParameter() { ParameterName = "id_city", SqlValue = idCity, SqlDbType = SqlDbType.Int };
            SqlParameter pAddress = new SqlParameter() { ParameterName = "address", SqlValue = address, SqlDbType = SqlDbType.NVarChar };
            SqlParameter pIdClient = new SqlParameter() { ParameterName = "id_contractor", SqlValue = idClient, SqlDbType = SqlDbType.Int };
            SqlParameter pServiceAdminSid = new SqlParameter() { ParameterName = "service_admin_sid", SqlValue = serviceAdminSid, SqlDbType = SqlDbType.VarChar };
            SqlParameter pServiceEngeneerSid = new SqlParameter() { ParameterName = "service_engeneer_sid", SqlValue = serviceEngeneerSid, SqlDbType = SqlDbType.VarChar };
            var dt = Db.UnitProg.ExecuteQueryStoredProcedure("get_service_claim_list", pMonth, pIdCity, pAddress, pIdClient, pServiceAdminSid, pServiceEngeneerSid);

            var lst = new List<PlanServiceIssue>();

            foreach (DataRow row in dt.Rows)
            {
                var model = new PlanServiceIssue(row);
                lst.Add(model);
            }

            return lst;
        }
Ejemplo n.º 2
0
        public HttpResponseMessage SavePlanServiceIssue(PlanServiceIssue model)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);

            try
            {
                model.CurUserAdSid = GetCurUser().Sid;
                int id = model.MobileSave();
                response.Content = new StringContent(String.Format("{{\"id\":{0}}}", id));
            }
            catch (Exception ex)
            {
                response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex));
            }
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            return response;
        }