示例#1
0
        public HttpResponseMessage queryCredit_date([FromBody] CREDIT_QUERY c)
        {
            Result <CREDIT> ru        = new Result <CREDIT>();
            List <CREDIT>   lcustomer = new List <CREDIT>();

            try
            {
                lcustomer = DB_Credit.getCredit_query(c);

                if (lcustomer.Count > 0)
                {
                    ru.code    = "7040";
                    ru.success = "true";
                    ru.message = "获取成功!";
                }
                else
                {
                    ru.code    = "7041";
                    ru.success = "false";
                    ru.message = "无数据";
                }
            }
            catch (Exception e)
            {
                ru.code    = "7042";
                ru.success = "false";
                ru.message = e.Message;
            }

            ru.systemTime = Conn.GetTimeStamp();
            ru.data       = lcustomer;

            return(Conn.toJson(ru));
        }
示例#2
0
        public HttpResponseMessage deleteCredit([FromBody] CREDIT c)
        {
            Result <CREDIT> ru     = new Result <CREDIT>();
            int             result = 0;

            try
            {
                result = DB_Credit.deleteCredit(c);

                if (result == 1)
                {
                    ru.code    = "7020";
                    ru.success = "true";
                    ru.message = "删除成功!";
                }
                else
                {
                    ru.code    = "7021";
                    ru.success = "false";
                    ru.message = "删除失败";
                }
            }
            catch (Exception e) {
                ru.code    = "7022";
                ru.success = "false";
                ru.message = e.Message;
            }

            ru.systemTime = Conn.GetTimeStamp();
            ru.data       = null;

            return(Conn.toJson(ru));
        }
示例#3
0
        public static List <USER> DataToUser(DataTable dt)
        {
            List <USER> list = new List <USER>();

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    USER d = new USER
                    {
                        telephone = dt.Rows[i]["TELEPHONE"].ToString(),
                        pass_word = dt.Rows[i]["PASS_WORD"].ToString(),
                        balance   = Convert.ToDecimal(dt.Rows[i]["BALANCE"].ToString()),
                        phone     = dt.Rows[i]["PHONE"].ToString(),
                        name      = dt.Rows[i]["NAME"].ToString(),
                        month_in  = DB_Credit.getTotalAmount("month", "收入", dt.Rows[i]["ID"].ToString()),
                        year_in   = DB_Credit.getTotalAmount("year", "收入", dt.Rows[i]["ID"].ToString()),
                        month_out = DB_Credit.getTotalAmount("month", "支出", dt.Rows[i]["ID"].ToString()),
                        year_out  = DB_Credit.getTotalAmount("year", "支出", dt.Rows[i]["ID"].ToString()),
                        id        = dt.Rows[i]["ID"].ToString(),
                    };
                    list.Add(d);
                }
            }
            return(list);
        }