コード例 #1
0
ファイル: PlaceFeeManager.cs プロジェクト: zhaoming35/gs_ims
 public override bool Remove(Info_place_fee t)
 {
     return(this.Repository.Remove <Tb_place_fee>()
            .Where().And(Tb_place_fee.Table.Fee_Id, t.Fee_Id)
            .EndWhere()
            .Save() > 0 ? true : false);
 }
コード例 #2
0
ファイル: PlaceFeeManager.cs プロジェクト: zhaoming35/gs_ims
 public override bool Update(Info_place_fee tNew, Info_place_fee tOld)
 {
     return(this.Repository.Update <Tb_place_fee>()
            .Set().AllFields(tNew)
            .EndSet()
            .Where()
            .And(Tb_place_fee.Table.Fee_Id, tOld.Fee_Id)
            .EndWhere()
            .Save() > 0 ? true : false);
 }
コード例 #3
0
ファイル: PlaceFeeManager.cs プロジェクト: zhaoming35/gs_ims
 public override bool Add(Info_place_fee t)
 {
     t.Fee_Id = NewId();
     return(this.Add(Repository, t));
 }
コード例 #4
0
        public bool Commit(Info_carriage_bill info)
        {
            Model.Tb_default_adress defaultAdress = defaultAdressManager.FindThe();
            Info_place_fee          feeOrigen;
            Info_place_fee          updateFee = new Info_place_fee();
            string transDirection;

            //装车地址是默认地址,发车
            if (info.Load_Place_Id == defaultAdress.Place_Id)
            {
                updateFee.Place_Id = info.Unload_Place_Id;
                transDirection     = "发车";
                feeOrigen          = this.Repository.Query().From <Model.Tb_place_fee>()
                                     .ToSelect().EndSelect()
                                     .ToWhere()
                                     .And(Model.Tb_place_fee.Table.Place_Id, info.Unload_Place_Id)
                                     .And(Model.Tb_place_fee.Table.Truck_Name, info.Trunk_Spec)
                                     .And(Model.Tb_place_fee.Table.Trans_Direction, transDirection)
                                     .EndWhere()
                                     .ToQuery()
                                     .First <Info_place_fee>();
            }
            else
            {
                updateFee.Place_Id = info.Load_Place_Id;
                //回车
                transDirection = "回车";
                feeOrigen      = this.Repository.Query().From <Model.Tb_place_fee>()
                                 .ToSelect().EndSelect()
                                 .ToWhere()
                                 .And(Model.Tb_place_fee.Table.Place_Id, info.Load_Place_Id)
                                 .And(Model.Tb_place_fee.Table.Truck_Name, info.Trunk_Spec)
                                 .And(Model.Tb_place_fee.Table.Trans_Direction, transDirection)
                                 .EndWhere()
                                 .ToQuery()
                                 .First <Info_place_fee>();
            }


            updateFee.Truck_Name      = info.Trunk_Spec;
            updateFee.Trans_Direction = transDirection;
            updateFee.Trans_Cost      = info.Carriage_Cost;
            if (feeOrigen != null)
            {
                updateFee.Place_Distance = feeOrigen.Place_Distance;
            }

            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新运费表
            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Update <Model.Tb_carriage_bill>()
                    .Set()
                    .Field(Model.Tb_carriage_bill.Table.Carriage_State, (int)Enum.CarriageState.Valid)
                    .EndSet()
                    .Where().And(Model.Tb_carriage_bill.Table.Carriage_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }
                return(true);
            }, info.Carriage_Id);

            //更新运输单状态
            exeBatchTrans.Append <Info_place_fee>((r, f) =>
            {
                if (r.Remove <Model.Tb_place_fee>()
                    .Where()
                    .And(Model.Tb_place_fee.Table.Place_Id, f.Place_Id)
                    .And(Model.Tb_place_fee.Table.Truck_Name, f.Truck_Name)
                    .And(Model.Tb_place_fee.Table.Trans_Direction, f.Trans_Direction)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, updateFee);

            exeBatchTrans.Append <Model.Info_place_fee>((r, m) =>
            {
                m.Fee_Id = NewId();
                return(this.Add(r, m));
            }, updateFee);

            return(exeBatchTrans.Save());
        }