Esempio n. 1
0
 private PalletType PalletTypeInfo_To_PalletType (PalletTypeInfo version)
 {
     PalletType e = new PalletType();
     e.ID = version.ID;
     e.ShipWay = version.ShipWay;
     e.RegId = version.RegId;
     e.Type = version.PalletType;
     e.OceanType = version.OceanType;
     e.StdPltFullQty = version.StdFullQty;
     e.MinQty = version.MinQty;
     e.MaxQty = version.MaxQty;
     e.Code = version.PalletCode;
     e.PltWeight = version.Weight;
     e.MinusPltWeight = version.InPltWeight;
     e.CheckCode = version.CheckCode;
     e.ChepPallet = version.ChepPallet;
     e.PalletLayer = version.PalletLayer;
     e.Editor = version.Editor;
     e.Cdt = version.Cdt;
     e.Udt = version.Udt;
     return e;
 }
Esempio n. 2
0
 public void Add(PalletTypeInfo item)
 {
     logger.Debug("(PalletTypeforICC)Add start, [item]:" + item);
     PalletType PalletType = null;
     IUnitOfWork work = new UnitOfWork();
     try
     {
         PalletType = PalletTypeInfo_To_PalletType(item);
         if (PalletType.MinQty > PalletType.MaxQty)
         {
             throw new Exception("[MinQty] must be less than [MaxQty]!");
         }
         else
         {
             iPalletTypeRepository.Add(PalletType, work);
             work.Commit();
         }
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
     finally
     {
         logger.Debug("(PalletTypeforICC)Add end, [item]:" + item);
     } 
 }
Esempio n. 3
0
        public void Update(PalletTypeInfo item)
        {
            logger.Debug("(PalletTypeforICC)Update start, [item]:" + item);
            PalletType PalletTypeOld = null;
            PalletType PalletTypeNew = null;
            IUnitOfWork work = new UnitOfWork();
            try
            {
                PalletTypeOld = iPalletTypeRepository.Find(item.ID);
                PalletTypeNew = PalletTypeInfo_To_PalletType(item);

                PalletTypeOld.ID = PalletTypeNew.ID;
                PalletTypeOld.ShipWay = PalletTypeNew.ShipWay;
                PalletTypeOld.RegId = PalletTypeNew.RegId;
                PalletTypeOld.Type = PalletTypeNew.Type;
                PalletTypeOld.StdPltFullQty = PalletTypeNew.StdPltFullQty;
                PalletTypeOld.MinQty = PalletTypeNew.MinQty;
                PalletTypeOld.MaxQty = PalletTypeNew.MaxQty;
                PalletTypeOld.Code = PalletTypeNew.Code;
                PalletTypeOld.PltWeight = PalletTypeNew.PltWeight;
                PalletTypeOld.MinusPltWeight = PalletTypeNew.MinusPltWeight;
                PalletTypeOld.CheckCode = PalletTypeNew.CheckCode;
                PalletTypeOld.ChepPallet = PalletTypeNew.ChepPallet;
                PalletTypeOld.PalletLayer = PalletTypeNew.PalletLayer;
                PalletTypeOld.Editor = PalletTypeNew.Editor;
                PalletTypeOld.Cdt = PalletTypeNew.Cdt;
                PalletTypeOld.Udt = PalletTypeNew.Udt;
                PalletTypeOld.OceanType = PalletTypeNew.OceanType;

                if (PalletTypeOld.MinQty > PalletTypeOld.MaxQty)
                {
                    throw new Exception("[MinQty] must be less than [MaxQty]!");
                }
                else
                {
                    iPalletTypeRepository.Update(PalletTypeOld, work);
                    work.Commit();
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            finally
            {
                logger.Debug("(PalletTypeforICC)Update end, [item]:" + item);
            } 
        }
Esempio n. 4
0
 public void Remove(PalletTypeInfo item)
 {
     logger.Debug("(PalletTypeforICC)Remove start, [item]:" + item);
     PalletType lstPalletType = null;
     IUnitOfWork work = new UnitOfWork();
     try
     {
         lstPalletType = iPalletTypeRepository.Find(item.ID);
         if (lstPalletType != null)
         {
             iPalletTypeRepository.Remove(lstPalletType, work);
         }
         work.Commit();
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
     finally
     {
         logger.Debug("(PalletTypeforICC)Remove end, [item]:" + item);
     } 
 }
Esempio n. 5
0
    protected void Delete_ServerClick(Object sender, EventArgs e)
    {
        try
        {
            PalletTypeInfo PalletTypeInfo = new PalletTypeInfo();

            PalletTypeInfo.ID = Convert.ToInt32(this.hidID.Value);
            PalletTypeInfo.ShipWay = this.hidShipWay2.Value;
            PalletTypeInfo.RegId = this.hidRegId_Carrier.Value;
            if (PalletTypeInfo.ID != 0)
            {
                iPalletTypeforICC.Remove(PalletTypeInfo);
            }
            IList<PalletTypeInfo> lstPalletTypeList = iPalletTypeforICC.GetPalletType(this.hidShipWay.Value, this.hidRegid.Value);
            bindTable(lstPalletTypeList, DEFAULT_ROWS);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            bindTable(null, DEFAULT_ROWS);
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            bindTable(null, DEFAULT_ROWS);
        }
        finally
        {
            hideWait();
        }
    }
Esempio n. 6
0
    protected void Save_ServerClick(Object sender, EventArgs e)
    {
        try
        {
            PalletTypeInfo PalletTypeInfo = new PalletTypeInfo();

            PalletTypeInfo.ShipWay = this.hidShipWay2.Value;
            PalletTypeInfo.RegId = this.hidRegId_Carrier.Value;
            PalletTypeInfo.PalletType = this.hidPalletType.Value;
			PalletTypeInfo.OceanType = this.hidOceanType.Value;
            PalletTypeInfo.PalletCode = this.hidPalletCode.Value;
            PalletTypeInfo.InPltWeight = this.hidInPltWeight.Value;
            PalletTypeInfo.StdFullQty = this.txtStdFullQty.Value;
            PalletTypeInfo.MinQty = Convert.ToInt32(this.txtMinQty.Value.Trim());
            PalletTypeInfo.MaxQty = Convert.ToInt32(this.txtMaxQty.Value.Trim());
            PalletTypeInfo.Weight = Convert.ToDecimal(this.txtWeight.Value.Trim());
            PalletTypeInfo.CheckCode = this.txtCheckCode.Value.Trim();
            PalletTypeInfo.ChepPallet = this.hidChepPallet.Value;
            PalletTypeInfo.PalletLayer = Convert.ToInt32(this.txtPalletLayer.Value.Trim());
            PalletTypeInfo.Editor = UserId;

            /*IList<PalletTypeInfo> lstPalletType = iPalletTypeforICC.CheckExistRangeQty(PalletTypeInfo.ShipWay, PalletTypeInfo.RegId, PalletTypeInfo.StdFullQty, PalletTypeInfo.PalletLayer, PalletTypeInfo.MaxQty, PalletTypeInfo.MinQty);
            if (lstPalletType.Count == 0)
            {
                iPalletTypeforICC.Add(PalletTypeInfo);
            }
            else
            {
                PalletTypeInfo.ID = lstPalletType[0].ID;
                iPalletTypeforICC.Update(PalletTypeInfo);
            }
            */

            string errDuplicatePalletType = this.GetLocalResourceObject(Pre + "_errDuplicatePalletType").ToString();

            IList<PalletTypeInfo> lstPalletType = iPalletTypeforICC.CheckExistRangeQty(PalletTypeInfo.ShipWay, PalletTypeInfo.RegId, PalletTypeInfo.StdFullQty, PalletTypeInfo.PalletLayer, PalletTypeInfo.OceanType, PalletTypeInfo.MaxQty, PalletTypeInfo.MinQty);
            string id = this.hidID.Value;
            if (string.IsNullOrEmpty(id))
            {
                if (lstPalletType.Count > 0)
                {
                    throw new Exception(errDuplicatePalletType);
                }

                iPalletTypeforICC.Add(PalletTypeInfo);
            }
            else
            {
                if ((lstPalletType.Count > 1) || (lstPalletType[0].ID != int.Parse(id)))
                {
                    throw new Exception(errDuplicatePalletType);
                }

                PalletTypeInfo.ID = lstPalletType[0].ID;
                iPalletTypeforICC.Update(PalletTypeInfo);
            }
			
            IList<PalletTypeInfo> lstPalletTypeList = iPalletTypeforICC.GetPalletType(this.hidShipWay.Value,this.hidRegid.Value);
            bindTable(lstPalletTypeList,DEFAULT_ROWS);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            bindTable(null, DEFAULT_ROWS);
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            bindTable(null, DEFAULT_ROWS);
        }
        finally
        {
            ScriptManager.RegisterStartupScript(this.Page, typeof(System.Object), "resetTableHeight", "resetTableHeight(); clearDetailInfo();", true);
            hideWait();
        }
    }