Example #1
0
        /// <summary>
        /// 根据编号获取信息
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public ContractOrder getContractOrder(string id)
        {
            string strSql = "select a.id, a.contractID, b.name as contractName, a.orderID, "
                            + "(select z.target from ADCostTarget z where z.id=a.costTargetID) as costTargetName, a.costTargetID, "
                            + "b.customerID, (select z.name from CustomerInfo z where z.id=b.customerID) as customerName, "
                            + "a.roomNum, a.begintime, a.endtime, a.memo, "
                            + "(select z.target from MakeCostTarget z where z.id=a.makeTargetID) as makeTargetName, a.makeTargetID, "
                            + "a.playReport, a.reportTime, a.mdate from OrderInfo a, ContractInfo b where a.contractID=b.contractID and a.orderID=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", id)
            };

            IDataReader       dr   = SqlHelper.ExecuteReader(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            IList <OrderInfo> list = DynamicBuilder <OrderInfo> .ConvertToList(dr);

            if (list != null && list.Count > 0)
            {
                ContractOrder en = new ContractOrder();
                en.order = list[0];

                DaContractInfo dal = new DaContractInfo();
                en.contract = dal.getEntity(list[0].contractID);

                return(en);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 搜索合同列表
        /// </summary>
        /// <returns></returns>
        public JsonResult ContractList_searcht(string id, string channel, string type, string state, string person, string billState, string date)
        {
            DaContractInfo dal = new DaContractInfo();
            IList<ContractInfo> contracts = dal.getList(id, channel, type, state, person, billState, date, BaseHelper.getCookie().id.ToString());

            double money = 0.0;
            foreach (ContractInfo en in contracts)
                money += en.money;

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";
            result.Data = new { total = contracts.Count, rows = contracts, money = money };
            return result;
        }
Example #3
0
        /// <summary>
        /// 根据编号获取信息
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public ContractOrder getContractOrder(string id)
        {
            string strSql = "select a.id, a.contractID, b.name as contractName, a.orderID, "
                + "(select z.target from ADCostTarget z where z.id=a.costTargetID) as costTargetName, a.costTargetID, "
                + "b.customerID, (select z.name from CustomerInfo z where z.id=b.customerID) as customerName, "
                + "a.roomNum, a.begintime, a.endtime, a.memo, "
                + "(select z.target from MakeCostTarget z where z.id=a.makeTargetID) as makeTargetName, a.makeTargetID, "
                + "a.playReport, a.reportTime, a.mdate from OrderInfo a, ContractInfo b where a.contractID=b.contractID and a.orderID=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", id)
            };

            IDataReader dr = SqlHelper.ExecuteReader(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            IList<OrderInfo> list = DynamicBuilder<OrderInfo>.ConvertToList(dr);

            if (list != null && list.Count > 0)
            {
                ContractOrder en = new ContractOrder();
                en.order = list[0];

                DaContractInfo dal = new DaContractInfo();
                en.contract = dal.getEntity(list[0].contractID);

                return en;
            }
            else
                return null;
        }
Example #4
0
        /// <summary>
        /// 获取合同列表
        /// </summary>
        /// <returns></returns>
        public JsonResult ContractList_getList()
        {
            DaContractInfo dal = new DaContractInfo();
            IList<ContractInfo> contracts = dal.getList(BaseHelper.getCookie().id.ToString());

            double money = 0.0;
            foreach(ContractInfo en in contracts)
                money += en.money;

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";
            result.Data = new { total = contracts.Count, rows = contracts, money = money };
            return result;
        }
Example #5
0
        /// <summary>
        /// 导出合同列表
        /// </summary>
        /// <param name="id"></param>
        /// <param name="channel"></param>
        /// <param name="type"></param>
        /// <param name="state"></param>
        /// <param name="person"></param>
        /// <param name="billState"></param>
        /// <param name="date"></param>
        public void ContractList_output(string id, string channel, string type, string state, string person, string billState, string date)
        {
            DaContractInfo dal = new DaContractInfo();
            DataTable dt = dal.getDataTable(id, channel, type, state, person, billState, date, BaseHelper.getCookie().id.ToString());

            if (dt.Rows.Count > 0)
            {
                string filename = "myContractList.xls";
                System.IO.StringWriter tw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
                DataGrid dgGrid = new DataGrid();
                dgGrid.DataSource = dt;
                dgGrid.DataBind();

                //Get the HTML for the control.
                dgGrid.RenderControl(hw);
                //Write the HTML back to the browser.
                //Response.ContentType = application/vnd.ms-excel;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
                Response.Write(tw.ToString());
            }
            else
            {
                Response.Write("无数据可导出!");
            }

            Response.End();
        }
Example #6
0
        /// <summary>
        /// 根据编号获取合同信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult ContractList_getContract(string id)
        {
            DaContractInfo dal = new DaContractInfo();
            ContractInfo contract = dal.getEntity(id);

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";
            result.Data = contract;
            return result;
        }
Example #7
0
        /// <summary>
        /// 修改合同状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public JsonResult ContractList_editContractState(string id, string state)
        {
            DaContractInfo dal = new DaContractInfo();
            ContractInfo en = new ContractInfo();
            en.contractID = id;
            en.state = Convert.ToInt32(state);

            var result = new CustomJsonResult();
            result.Data = dal.editContractState(en);
            return result;
        }
Example #8
0
        public JsonResult ContractList_editContract(string id, string name, string version, string price, string num,
            string money, string make, string back, string type, string channel, string begintime, string endtime,
            string zq, string person, string mDate, string memo)
        {
            ContractInfo en = new ContractInfo();
            en.contractID = id;
            en.name = name;
            en.version = version;

            if (price.Trim() != "")
                en.price = Convert.ToDouble(price);

            if (num.Trim() != "")
                en.roomNum = Convert.ToInt32(num);

            if (money.Trim() != "")
                en.money = Convert.ToDouble(money);

            if (make.Trim() != "")
                en.makeCost = Convert.ToDouble(make);

            if (back.Trim() != "")
                en.backMoney = Convert.ToDouble(back);

            if (type.Trim() != "")
                en.type = Convert.ToInt32(type);

            if (channel.Trim() != "")
                en.channelID = Convert.ToInt32(channel);

            if (begintime.Trim() != "")
                en.begintime = Convert.ToDateTime(begintime);

            if (endtime.Trim() != "")
                en.endtime = Convert.ToDateTime(endtime);

            if (zq.Trim() != "")
                en.ZQ = Convert.ToDouble(zq);

            if (person.Trim() != "")
                en.personID = Convert.ToInt32(person);

            if (mDate.Trim() != "")
                en.mDate = Convert.ToDateTime(mDate);

            en.memo = memo;

            DaContractInfo dal = new DaContractInfo();
            var result = new CustomJsonResult();
            result.Data = dal.update(en);
            return result;
        }
Example #9
0
        /// <summary>
        /// 根据合同编号获取合同信息填充下单界面
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public JsonResult Order_getContract(string id)
        {
            DaContractInfo dal = new DaContractInfo();
            ContractInfo en = dal.getEntity(id);

            var result = new CustomJsonResult();
            result.Data = en;
            return result;
        }
Example #10
0
        /// <summary>
        /// 获取合同列表
        /// </summary>
        /// <returns></returns>
        public JsonResult Contract_getList()
        {
            DaContractInfo dal = new DaContractInfo();
            IList<ContractInfo> contracts = dal.getList(BaseHelper.getCookie().id.ToString());

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";
            result.Data = new { total = contracts.Count, rows = contracts };
            return result;
        }