Ejemplo n.º 1
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            //model.FactDispatchTime = Utils.StrToDateTime(txtFactDispatchTime.Text.Trim(), DateTime.Now);
            //model.Advance = Utils.StrToDecimal(txtAdvance.Text.Trim(), 0.00M);
            model.AddTime = DateTime.Now;
            model.Status  = 1;

            string[] itemIds            = Request.Params.GetValues("transportOrderItemId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");


            List <Model.TransportOrderItem> item_list = new List <Model.TransportOrderItem>();

            BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();

            for (int i = 0; i < itemIds.Length; i++)
            {
                Model.TransportOrderItem item = itemBll.GetModel(Utils.StrToInt(itemIds[i], 0));
                if (item != null)
                {
                    item.FactDispatchCount = Utils.StrToDecimal(factDispatchCounts[i], item.FactDispatchCount);
                    item_list.Add(item);
                }
            }

            if (bll.Update(model, item_list))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "登记出车信息:" + model.Code); //记录日志
                result = true;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public bool UpdateExpensesInfo(Model.TransportOrderItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update mtms_TransportOrderItem set ");
            strSql.Append(" FactDispatchCount = @FactDispatchCount, ");
            strSql.Append(" FactReceivedCount = @FactReceivedCount, ");
            strSql.Append(" TotalPrice = @TotalPrice, ");
            strSql.Append(" RoundStatus = @RoundStatus ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",                SqlDbType.Int,     4),
                new SqlParameter("@FactDispatchCount", SqlDbType.Decimal, 9),
                new SqlParameter("@FactReceivedCount", SqlDbType.Decimal, 9),
                new SqlParameter("@TotalPrice",        SqlDbType.Decimal, 9),
                new SqlParameter("@RoundStatus",       SqlDbType.VarChar, 254)
            };

            parameters[0].Value = model.Id;
            parameters[1].Value = model.FactDispatchCount;
            parameters[2].Value = model.FactReceivedCount;
            parameters[3].Value = model.TotalPrice;
            parameters[4].Value = model.RoundStatus;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TransportOrderItem GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id, TransportOrderId, OrderId, OrderCode, RoundStatus, ContractNumber, BillNumber, Shipper, Receiver, LoadingAddress, UnloadingAddress, Goods, Unit, FactDispatchCount, FactReceivedCount, CompensationCosts, MyCosts, Haulway, LoadingCapacityRunning, NoLoadingCapacityRunning, Formula, UnitPrice, TotalPrice, CompanyPrice  ");
            strSql.Append("  from mtms_TransportOrderItem ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;


            Model.TransportOrderItem model = new Model.TransportOrderItem();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TransportOrderId"].ToString() != "")
                {
                    model.TransportOrderId = int.Parse(ds.Tables[0].Rows[0]["TransportOrderId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderId"].ToString() != "")
                {
                    model.OrderId = int.Parse(ds.Tables[0].Rows[0]["OrderId"].ToString());
                }
                model.OrderCode        = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                model.RoundStatus      = ds.Tables[0].Rows[0]["RoundStatus"].ToString();
                model.ContractNumber   = ds.Tables[0].Rows[0]["ContractNumber"].ToString();
                model.BillNumber       = ds.Tables[0].Rows[0]["BillNumber"].ToString();
                model.Shipper          = ds.Tables[0].Rows[0]["Shipper"].ToString();
                model.Receiver         = ds.Tables[0].Rows[0]["Receiver"].ToString();
                model.LoadingAddress   = ds.Tables[0].Rows[0]["LoadingAddress"].ToString();
                model.UnloadingAddress = ds.Tables[0].Rows[0]["UnloadingAddress"].ToString();
                model.Goods            = ds.Tables[0].Rows[0]["Goods"].ToString();
                model.Unit             = ds.Tables[0].Rows[0]["Unit"].ToString();
                if (ds.Tables[0].Rows[0]["FactDispatchCount"].ToString() != "")
                {
                    model.FactDispatchCount = decimal.Parse(ds.Tables[0].Rows[0]["FactDispatchCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactReceivedCount"].ToString() != "")
                {
                    model.FactReceivedCount = decimal.Parse(ds.Tables[0].Rows[0]["FactReceivedCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompensationCosts"].ToString() != "")
                {
                    model.CompensationCosts = decimal.Parse(ds.Tables[0].Rows[0]["CompensationCosts"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MyCosts"].ToString() != "")
                {
                    model.MyCosts = decimal.Parse(ds.Tables[0].Rows[0]["MyCosts"].ToString());
                }
                model.Haulway = ds.Tables[0].Rows[0]["Haulway"].ToString();
                if (ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString() != "")
                {
                    model.LoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString() != "")
                {
                    model.NoLoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString());
                }
                model.Formula = ds.Tables[0].Rows[0]["Formula"].ToString();
                if (ds.Tables[0].Rows[0]["UnitPrice"].ToString() != "")
                {
                    model.UnitPrice = decimal.Parse(ds.Tables[0].Rows[0]["UnitPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "")
                {
                    model.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompanyPrice"].ToString() != "")
                {
                    model.CompanyPrice = decimal.Parse(ds.Tables[0].Rows[0]["CompanyPrice"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.TransportOrderItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into mtms_TransportOrderItem(");
            strSql.Append("TransportOrderId,RoundStatus,ContractNumber,BillNumber,Shipper,Receiver,LoadingAddress,UnloadingAddress,Goods,Unit,FactDispatchCount,FactReceivedCount,CompensationCosts,MyCosts,Haulway,LoadingCapacityRunning,NoLoadingCapacityRunning,Formula,UnitPrice,TotalPrice,CompanyPrice,DispatchCount,OrderCode,OrderId");
            strSql.Append(") values (");
            strSql.Append("@TransportOrderId,@RoundStatus,@ContractNumber,@BillNumber,@Shipper,@Receiver,@LoadingAddress,@UnloadingAddress,@Goods,@Unit,@FactDispatchCount,@FactReceivedCount,@CompensationCosts,@MyCosts,@Haulway,@LoadingCapacityRunning,@NoLoadingCapacityRunning,@Formula,@UnitPrice,@TotalPrice,@CompanyPrice,@DispatchCount,@OrderCode,@OrderId");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TransportOrderId",         SqlDbType.Int,       4),
                new SqlParameter("@RoundStatus",              SqlDbType.VarChar, 254),
                new SqlParameter("@ContractNumber",           SqlDbType.VarChar, 254),
                new SqlParameter("@BillNumber",               SqlDbType.VarChar, 254),
                new SqlParameter("@Shipper",                  SqlDbType.VarChar, 254),
                new SqlParameter("@Receiver",                 SqlDbType.VarChar, 254),
                new SqlParameter("@LoadingAddress",           SqlDbType.VarChar, 254),
                new SqlParameter("@UnloadingAddress",         SqlDbType.VarChar, 254),
                new SqlParameter("@Goods",                    SqlDbType.VarChar, 254),
                new SqlParameter("@Unit",                     SqlDbType.VarChar, 254),
                new SqlParameter("@FactDispatchCount",        SqlDbType.Decimal,   9),
                new SqlParameter("@FactReceivedCount",        SqlDbType.Decimal,   9),
                new SqlParameter("@CompensationCosts",        SqlDbType.Decimal,   9),
                new SqlParameter("@MyCosts",                  SqlDbType.Decimal,   9),
                new SqlParameter("@Haulway",                  SqlDbType.VarChar, 254),
                new SqlParameter("@LoadingCapacityRunning",   SqlDbType.Decimal,   9),
                new SqlParameter("@NoLoadingCapacityRunning", SqlDbType.Decimal,   9),
                new SqlParameter("@Formula",                  SqlDbType.VarChar, 254),
                new SqlParameter("@UnitPrice",                SqlDbType.Decimal,   9),
                new SqlParameter("@TotalPrice",               SqlDbType.Decimal,   9),
                new SqlParameter("@CompanyPrice",             SqlDbType.Decimal,   9),
                new SqlParameter("@DispatchCount",            SqlDbType.Decimal,   9),
                new SqlParameter("@OrderCode",                SqlDbType.VarChar, 254),
                new SqlParameter("@OrderId",                  SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.TransportOrderId;
            parameters[1].Value  = model.RoundStatus;
            parameters[2].Value  = model.ContractNumber;
            parameters[3].Value  = model.BillNumber;
            parameters[4].Value  = model.Shipper;
            parameters[5].Value  = model.Receiver;
            parameters[6].Value  = model.LoadingAddress;
            parameters[7].Value  = model.UnloadingAddress;
            parameters[8].Value  = model.Goods;
            parameters[9].Value  = model.Unit;
            parameters[10].Value = model.FactDispatchCount;
            parameters[11].Value = model.FactReceivedCount;
            parameters[12].Value = model.CompensationCosts;
            parameters[13].Value = model.MyCosts;
            parameters[14].Value = model.Haulway;
            parameters[15].Value = model.LoadingCapacityRunning;
            parameters[16].Value = model.NoLoadingCapacityRunning;
            parameters[17].Value = model.Formula;
            parameters[18].Value = model.UnitPrice;
            parameters[19].Value = model.TotalPrice;
            parameters[20].Value = model.CompanyPrice;
            parameters[21].Value = model.DispatchCount;
            parameters[22].Value = model.OrderCode;
            parameters[23].Value = model.OrderId;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.TransportOrderItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update mtms_TransportOrderItem set ");

            strSql.Append(" TransportOrderId = @TransportOrderId , ");
            strSql.Append(" RoundStatus = @RoundStatus , ");
            strSql.Append(" ContractNumber = @ContractNumber , ");
            strSql.Append(" BillNumber = @BillNumber , ");
            strSql.Append(" Shipper = @Shipper , ");
            strSql.Append(" Receiver = @Receiver , ");
            strSql.Append(" LoadingAddress = @LoadingAddress , ");
            strSql.Append(" UnloadingAddress = @UnloadingAddress , ");
            strSql.Append(" Goods = @Goods , ");
            strSql.Append(" Unit = @Unit , ");
            strSql.Append(" FactDispatchCount = @FactDispatchCount , ");
            strSql.Append(" FactReceivedCount = @FactReceivedCount , ");
            strSql.Append(" CompensationCosts = @CompensationCosts , ");
            strSql.Append(" MyCosts = @MyCosts , ");
            strSql.Append(" Haulway = @Haulway , ");
            strSql.Append(" LoadingCapacityRunning = @LoadingCapacityRunning , ");
            strSql.Append(" NoLoadingCapacityRunning = @NoLoadingCapacityRunning , ");
            strSql.Append(" Formula = @Formula , ");
            strSql.Append(" UnitPrice = @UnitPrice , ");
            strSql.Append(" TotalPrice = @TotalPrice , ");
            strSql.Append(" CompanyPrice = @CompanyPrice,  ");
            strSql.Append(" OrderCode = @OrderCode,  ");
            strSql.Append(" OrderId = @OrderId  ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",                       SqlDbType.Int,       4),
                new SqlParameter("@TransportOrderId",         SqlDbType.Int,       4),
                new SqlParameter("@RoundStatus",              SqlDbType.VarChar, 254),
                new SqlParameter("@ContractNumber",           SqlDbType.VarChar, 254),
                new SqlParameter("@BillNumber",               SqlDbType.VarChar, 254),
                new SqlParameter("@Shipper",                  SqlDbType.VarChar, 254),
                new SqlParameter("@Receiver",                 SqlDbType.VarChar, 254),
                new SqlParameter("@LoadingAddress",           SqlDbType.VarChar, 254),
                new SqlParameter("@UnloadingAddress",         SqlDbType.VarChar, 254),
                new SqlParameter("@Goods",                    SqlDbType.VarChar, 254),
                new SqlParameter("@Unit",                     SqlDbType.VarChar, 254),
                new SqlParameter("@FactDispatchCount",        SqlDbType.Decimal,   9),
                new SqlParameter("@FactReceivedCount",        SqlDbType.Decimal,   9),
                new SqlParameter("@CompensationCosts",        SqlDbType.Decimal,   9),
                new SqlParameter("@MyCosts",                  SqlDbType.Decimal,   9),
                new SqlParameter("@Haulway",                  SqlDbType.VarChar, 254),
                new SqlParameter("@LoadingCapacityRunning",   SqlDbType.Decimal,   9),
                new SqlParameter("@NoLoadingCapacityRunning", SqlDbType.Decimal,   9),
                new SqlParameter("@Formula",                  SqlDbType.VarChar, 254),
                new SqlParameter("@UnitPrice",                SqlDbType.Decimal,   9),
                new SqlParameter("@TotalPrice",               SqlDbType.Decimal,   9),
                new SqlParameter("@CompanyPrice",             SqlDbType.Decimal,   9),
                new SqlParameter("@OrderCode",                SqlDbType.VarChar, 254),
                new SqlParameter("@OrderId",                  SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.TransportOrderId;
            parameters[2].Value  = model.RoundStatus;
            parameters[3].Value  = model.ContractNumber;
            parameters[4].Value  = model.BillNumber;
            parameters[5].Value  = model.Shipper;
            parameters[6].Value  = model.Receiver;
            parameters[7].Value  = model.LoadingAddress;
            parameters[8].Value  = model.UnloadingAddress;
            parameters[9].Value  = model.Goods;
            parameters[10].Value = model.Unit;
            parameters[11].Value = model.FactDispatchCount;
            parameters[12].Value = model.FactReceivedCount;
            parameters[13].Value = model.CompensationCosts;
            parameters[14].Value = model.MyCosts;
            parameters[15].Value = model.Haulway;
            parameters[16].Value = model.LoadingCapacityRunning;
            parameters[17].Value = model.NoLoadingCapacityRunning;
            parameters[18].Value = model.Formula;
            parameters[19].Value = model.UnitPrice;
            parameters[20].Value = model.TotalPrice;
            parameters[21].Value = model.CompanyPrice;
            parameters[22].Value = model.OrderCode;
            parameters[23].Value = model.OrderId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.TransportOrderItem> DataTableToList(DataTable dt)
        {
            List<Model.TransportOrderItem> modelList = new List<Model.TransportOrderItem>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.TransportOrderItem model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.TransportOrderItem();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["TransportOrderId"].ToString() != "")
                    {
                        model.TransportOrderId = int.Parse(dt.Rows[n]["TransportOrderId"].ToString());
                    }
                    model.RoundStatus = dt.Rows[n]["RoundStatus"].ToString();
                    model.ContractNumber = dt.Rows[n]["ContractNumber"].ToString();
                    model.BillNumber = dt.Rows[n]["BillNumber"].ToString();
                    model.Shipper = dt.Rows[n]["Shipper"].ToString();
                    model.Receiver = dt.Rows[n]["Receiver"].ToString();
                    model.LoadingAddress = dt.Rows[n]["LoadingAddress"].ToString();
                    model.UnloadingAddress = dt.Rows[n]["UnloadingAddress"].ToString();
                    model.Goods = dt.Rows[n]["Goods"].ToString();
                    model.Unit = dt.Rows[n]["Unit"].ToString();
                    if (dt.Rows[n]["FactDispatchCount"].ToString() != "")
                    {
                        model.FactDispatchCount = decimal.Parse(dt.Rows[n]["FactDispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactReceivedCount"].ToString() != "")
                    {
                        model.FactReceivedCount = decimal.Parse(dt.Rows[n]["FactReceivedCount"].ToString());
                    }
                    if (dt.Rows[n]["CompensationCosts"].ToString() != "")
                    {
                        model.CompensationCosts = decimal.Parse(dt.Rows[n]["CompensationCosts"].ToString());
                    }
                    if (dt.Rows[n]["MyCosts"].ToString() != "")
                    {
                        model.MyCosts = decimal.Parse(dt.Rows[n]["MyCosts"].ToString());
                    }
                    model.Haulway = dt.Rows[n]["Haulway"].ToString();
                    if (dt.Rows[n]["LoadingCapacityRunning"].ToString() != "")
                    {
                        model.LoadingCapacityRunning = decimal.Parse(dt.Rows[n]["LoadingCapacityRunning"].ToString());
                    }
                    if (dt.Rows[n]["NoLoadingCapacityRunning"].ToString() != "")
                    {
                        model.NoLoadingCapacityRunning = decimal.Parse(dt.Rows[n]["NoLoadingCapacityRunning"].ToString());
                    }
                    model.Formula = dt.Rows[n]["Formula"].ToString();
                    if (dt.Rows[n]["UnitPrice"].ToString() != "")
                    {
                        model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString());
                    }
                    if (dt.Rows[n]["TotalPrice"].ToString() != "")
                    {
                        model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString());
                    }
                    if (dt.Rows[n]["CompanyPrice"].ToString() != "")
                    {
                        model.CompanyPrice = decimal.Parse(dt.Rows[n]["CompanyPrice"].ToString());
                    }

                    modelList.Add(model);
                }
            }
            return modelList;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TransportOrderItem GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id, TransportOrderId, OrderId, OrderCode, RoundStatus, ContractNumber, BillNumber, Shipper, Receiver, LoadingAddress, UnloadingAddress, Goods, Unit, FactDispatchCount, FactReceivedCount, CompensationCosts, MyCosts, Haulway, LoadingCapacityRunning, NoLoadingCapacityRunning, Formula, UnitPrice, TotalPrice, CompanyPrice  ");
            strSql.Append("  from mtms_TransportOrderItem ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            Model.TransportOrderItem model = new Model.TransportOrderItem();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TransportOrderId"].ToString() != "")
                {
                    model.TransportOrderId = int.Parse(ds.Tables[0].Rows[0]["TransportOrderId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderId"].ToString() != "")
                {
                    model.OrderId = int.Parse(ds.Tables[0].Rows[0]["OrderId"].ToString());
                }
                model.OrderCode = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                model.RoundStatus = ds.Tables[0].Rows[0]["RoundStatus"].ToString();
                model.ContractNumber = ds.Tables[0].Rows[0]["ContractNumber"].ToString();
                model.BillNumber = ds.Tables[0].Rows[0]["BillNumber"].ToString();
                model.Shipper = ds.Tables[0].Rows[0]["Shipper"].ToString();
                model.Receiver = ds.Tables[0].Rows[0]["Receiver"].ToString();
                model.LoadingAddress = ds.Tables[0].Rows[0]["LoadingAddress"].ToString();
                model.UnloadingAddress = ds.Tables[0].Rows[0]["UnloadingAddress"].ToString();
                model.Goods = ds.Tables[0].Rows[0]["Goods"].ToString();
                model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                if (ds.Tables[0].Rows[0]["FactDispatchCount"].ToString() != "")
                {
                    model.FactDispatchCount = decimal.Parse(ds.Tables[0].Rows[0]["FactDispatchCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactReceivedCount"].ToString() != "")
                {
                    model.FactReceivedCount = decimal.Parse(ds.Tables[0].Rows[0]["FactReceivedCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompensationCosts"].ToString() != "")
                {
                    model.CompensationCosts = decimal.Parse(ds.Tables[0].Rows[0]["CompensationCosts"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MyCosts"].ToString() != "")
                {
                    model.MyCosts = decimal.Parse(ds.Tables[0].Rows[0]["MyCosts"].ToString());
                }
                model.Haulway = ds.Tables[0].Rows[0]["Haulway"].ToString();
                if (ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString() != "")
                {
                    model.LoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString() != "")
                {
                    model.NoLoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString());
                }
                model.Formula = ds.Tables[0].Rows[0]["Formula"].ToString();
                if (ds.Tables[0].Rows[0]["UnitPrice"].ToString() != "")
                {
                    model.UnitPrice = decimal.Parse(ds.Tables[0].Rows[0]["UnitPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "")
                {
                    model.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompanyPrice"].ToString() != "")
                {
                    model.CompanyPrice = decimal.Parse(ds.Tables[0].Rows[0]["CompanyPrice"].ToString());
                }

                return model;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 8
0
 public bool UpdateExpensesInfo(Model.TransportOrderItem model)
 {
     return(dal.UpdateExpensesInfo(model));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.TransportOrderItem model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.TransportOrderItem model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.TransportOrderItem> DataTableToList(DataTable dt)
        {
            List <Model.TransportOrderItem> modelList = new List <Model.TransportOrderItem>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.TransportOrderItem model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.TransportOrderItem();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["TransportOrderId"].ToString() != "")
                    {
                        model.TransportOrderId = int.Parse(dt.Rows[n]["TransportOrderId"].ToString());
                    }
                    model.RoundStatus      = dt.Rows[n]["RoundStatus"].ToString();
                    model.ContractNumber   = dt.Rows[n]["ContractNumber"].ToString();
                    model.BillNumber       = dt.Rows[n]["BillNumber"].ToString();
                    model.Shipper          = dt.Rows[n]["Shipper"].ToString();
                    model.Receiver         = dt.Rows[n]["Receiver"].ToString();
                    model.LoadingAddress   = dt.Rows[n]["LoadingAddress"].ToString();
                    model.UnloadingAddress = dt.Rows[n]["UnloadingAddress"].ToString();
                    model.Goods            = dt.Rows[n]["Goods"].ToString();
                    model.Unit             = dt.Rows[n]["Unit"].ToString();
                    if (dt.Rows[n]["FactDispatchCount"].ToString() != "")
                    {
                        model.FactDispatchCount = decimal.Parse(dt.Rows[n]["FactDispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactReceivedCount"].ToString() != "")
                    {
                        model.FactReceivedCount = decimal.Parse(dt.Rows[n]["FactReceivedCount"].ToString());
                    }
                    if (dt.Rows[n]["CompensationCosts"].ToString() != "")
                    {
                        model.CompensationCosts = decimal.Parse(dt.Rows[n]["CompensationCosts"].ToString());
                    }
                    if (dt.Rows[n]["MyCosts"].ToString() != "")
                    {
                        model.MyCosts = decimal.Parse(dt.Rows[n]["MyCosts"].ToString());
                    }
                    model.Haulway = dt.Rows[n]["Haulway"].ToString();
                    if (dt.Rows[n]["LoadingCapacityRunning"].ToString() != "")
                    {
                        model.LoadingCapacityRunning = decimal.Parse(dt.Rows[n]["LoadingCapacityRunning"].ToString());
                    }
                    if (dt.Rows[n]["NoLoadingCapacityRunning"].ToString() != "")
                    {
                        model.NoLoadingCapacityRunning = decimal.Parse(dt.Rows[n]["NoLoadingCapacityRunning"].ToString());
                    }
                    model.Formula = dt.Rows[n]["Formula"].ToString();
                    if (dt.Rows[n]["UnitPrice"].ToString() != "")
                    {
                        model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString());
                    }
                    if (dt.Rows[n]["TotalPrice"].ToString() != "")
                    {
                        model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString());
                    }
                    if (dt.Rows[n]["CompanyPrice"].ToString() != "")
                    {
                        model.CompanyPrice = decimal.Parse(dt.Rows[n]["CompanyPrice"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 12
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            string[] orderIds           = Request.Params.GetValues("orderId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");

            if (orderIds == null)
            {
                JscriptMsg("请填写运输项信息!", "", "Error");
                return(false);
            }
            model.DispatchTime     = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime = DateTime.Now;
            model.BackTime         = Convert.ToDateTime(txtBackTime.Text.Trim());
            model.FactBackTime     = DateTime.Now;
            model.MotorcadeName    = ddlMotorcade.SelectedValue;
            model.CarNumber        = ddlCarNumber.SelectedValue;
            model.Driver           = txtDriver.Text.Trim();
            model.Remarks          = txtRemarks.Text.Trim();
            model.AddTime          = DateTime.Now;
            model.Status           = 0;

            List <Model.TransportOrderItem> item_list = new List <Model.TransportOrderItem>();
            List <Model.Order> order_list             = new List <Model.Order>();//订单

            BLL.Order orderBll = new BLL.Order();

            //new BLL.TransportOrderItem().DeleteBy(model.Id);//删除该运输单下 所有 运输子项

            for (int i = 0; i < orderIds.Length; i++)
            {
                Model.Order order = orderBll.GetModel(Convert.ToInt32(orderIds[i]));
                if (order != null)
                {
                    Model.TransportOrderItem item = new Model.TransportOrderItem();
                    item.OrderId                  = order.Id;
                    item.OrderCode                = order.Code;
                    item.ContractNumber           = order.ContractNumber;
                    item.BillNumber               = order.BillNumber;
                    item.Shipper                  = order.Shipper;
                    item.Receiver                 = order.Receiver;
                    item.LoadingAddress           = order.LoadingAddress;
                    item.UnloadingAddress         = order.UnloadingAddress;
                    item.Goods                    = order.Goods;
                    item.Unit                     = order.Unit;
                    item.DispatchCount            = order.Quantity;
                    item.FactDispatchCount        = Convert.ToDecimal(factDispatchCounts[i]);
                    item.FactReceivedCount        = item.FactDispatchCount;
                    item.CompensationCosts        = 0.00M;
                    item.MyCosts                  = 0.00m;
                    item.Haulway                  = order.Haulway;
                    item.LoadingCapacityRunning   = order.LoadingCapacityRunning;
                    item.NoLoadingCapacityRunning = order.NoLoadingCapacityRunning;
                    item.Formula                  = order.Formula;
                    item.UnitPrice                = order.UnitPrice;
                    item.TotalPrice               = order.TotalPrice;
                    item.CompanyPrice             = item.TotalPrice;
                    item_list.Add(item);


                    //int status = (order.IsCharteredCar == 1 || ((order.DispatchedCount + item.FactDispatchCount) == order.Quantity)) ? 1 : 0;
                    //order.Status = status;
                    //order.DispatchedCount = item.FactDispatchCount;
                    //order_list.Add(order);
                }
            }
            if (bll.Update(model, item_list, order_list))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改运输单信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 13
0
        private bool DoAdd()
        {
            bool result = false;
            Model.TransportOrder model = new Model.TransportOrder();
            BLL.TransportOrder bll = new BLL.TransportOrder();

            string[] orderIds = Request.Params.GetValues("orderId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");
            if (orderIds == null)
            {
                JscriptMsg("请填写运输项信息!", "", "Error");
                return false;
            }

            model.Code = "No" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.DispatchTime = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime = DateTime.Now;
            model.BackTime = Convert.ToDateTime(txtBackTime.Text.Trim());
            model.FactBackTime = DateTime.Now;
            model.MotorcadeName = ddlMotorcade.SelectedValue;
            model.CarNumber = ddlCarNumber.SelectedValue;
            model.Driver = txtDriver.Text.Trim();
            model.Remarks = txtRemarks.Text.Trim();

            List<Model.TransportOrderItem> item_list = new List<Model.TransportOrderItem>();//运输子项
            List<Model.Order> order_list = new List<Model.Order>();//订单
            BLL.Order orderBll = new BLL.Order();
            for (int i = 0; i < orderIds.Length; i++)
            {
                Model.Order order = orderBll.GetModel(Convert.ToInt32(orderIds[i]));
                if (order != null)
                {
                    Model.TransportOrderItem item = new Model.TransportOrderItem();
                    item.OrderId = order.Id;
                    item.OrderCode = order.Code;
                    item.ContractNumber = order.ContractNumber;
                    item.BillNumber = order.BillNumber;
                    item.Shipper = order.Shipper;
                    item.Receiver = order.Receiver;
                    item.LoadingAddress = order.LoadingAddress;
                    item.UnloadingAddress = order.UnloadingAddress;
                    item.Goods = order.Goods;
                    item.Unit = order.Unit;
                    item.DispatchCount = order.Quantity;
                    item.FactDispatchCount = Convert.ToDecimal(factDispatchCounts[i]);
                    item.FactReceivedCount = item.FactDispatchCount;
                    item.CompensationCosts = 0.00M;
                    item.MyCosts = 0.00m;
                    item.Haulway = order.Haulway;
                    item.LoadingCapacityRunning = order.LoadingCapacityRunning;
                    item.NoLoadingCapacityRunning = order.NoLoadingCapacityRunning;
                    item.Formula = order.Formula;
                    item.UnitPrice = order.UnitPrice;
                    item.TotalPrice = order.TotalPrice;
                    item.CompanyPrice = item.TotalPrice;
                    item_list.Add(item);

                   // int status = (order.IsCharteredCar == 1 || ((order.DispatchedCount + item.FactDispatchCount) == order.Quantity)) ? 1 : 0;
                    //order.Status = status;
                    order.DispatchedCount = order.DispatchedCount + item.FactDispatchCount;
                    order_list.Add(order);
                }
            }
            if (bll.Add(model,item_list,order_list) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加运输单:" + model.Code); //记录日志
                result = true;
            }
            return result;
        }