public DataMessage GetOfficerVillages(string officerCode)
        {
            var sSQL = @"SELECT LV.LocationId,code,LW.locationname Ward,LV.LocationName Village,LW.LocationID WardID FROM tblOfficerVillages OV
                        INNER JOIN tblOfficer O ON OV.OfficerId = O.OfficerID AND O.ValidityTo IS NULL AND OV.ValidityTo IS NULL
                        LEFT JOIN tblLocations LV ON LV.LocationId = OV.LocationId AND LV.LocationType = 'V' AND LV.ValidityTo IS NULL
                        LEFT JOIN tblLocations LW ON LW.LocationId = LV.ParentLocationId AND LW.ValidityTo IS NULL
		                WHERE O.Code = @EnrollmentOfficerCode"        ;

            DataHelper helper = new DataHelper(Configuration);

            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@EnrollmentOfficerCode", officerCode)
            };

            DataMessage message;

            try
            {
                var response = helper.GetDataTable(sSQL, sqlParameters, System.Data.CommandType.Text);
                message = new ImisApiResponse(0, false, response, 0).Message;
            }
            catch (Exception e)
            {
                message = new ImisApiResponse(e).Message;
            }

            return(message);
        }
Пример #2
0
        public DataMessage MatchPayment(MatchModel model)
        {
            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@PaymentID",   model.internal_identifier),
                new SqlParameter("@AuditUserId", model.audit_user_id)
            };

            DataMessage message;

            try
            {
                DataSet data = dh.FillDataSet("uspMatchPayment", sqlParameters, CommandType.StoredProcedure);

                //bool error = false;
                DataTable dt = new DataTable();

                if (data.Tables.Count > 0)
                {
                    dt = data.Tables[data.Tables.Count - 1];
                }

                message = new MatchPayResponse(dh.ReturnValue, false, dt, (int)Language).Message;
                if (model.internal_identifier != null && !message.ErrorOccured)
                {
                    GetPaymentInfo(model.internal_identifier.ToString());
                }
            }
            catch (Exception e)
            {
                message = new ImisApiResponse(e).Message;
            }

            return(message);
        }
Пример #3
0
        public DataMessage MatchPayment(MatchModel model)
        {
            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@PaymentID",   model.internal_identifier),
                new SqlParameter("@AuditUserId", model.audit_user_id)
            };

            DataMessage message;

            try
            {
                DataSet data = dh.FillDataSet("uspMatchPayment", sqlParameters, CommandType.StoredProcedure);

                //bool error = false;
                DataTable dt = new DataTable();

                if (data.Tables.Count > 0)
                {
                    dt = data.Tables[data.Tables.Count - 1];

                    //    error = true;

                    //    if (dt.Rows.Count > 0)
                    //    {
                    //        var firstRow = dt.Rows[0];

                    //        if (Convert.ToInt32(firstRow["PaymentMatched"]) > 0)
                    //        {
                    //            error = false;
                    //        }

                    //    }
                    //    else
                    //    {
                    //        error = true;
                    //    }
                }

                message = new MatchPayResponse(dh.ReturnValue, false, dt, (int)Language).Message;
                if (model.internal_identifier != 0 && !message.ErrorOccured)
                {
                    GetPaymentInfo(model.internal_identifier);
                }
            }
            catch (Exception e)
            {
                message = new ImisApiResponse(e).Message;
            }

            return(message);
        }