Exemple #1
0
        private BatteryDef convert(OlymBatteryInfo data)
        {
            BatteryDef item = new BatteryDef();
            item.BatteryVC = data.hppn;
            item.Hssn = data.hssn;
            item.Editor = data.editor;

            if (data.cdt == DateTime.MinValue)
            {
                item.cdt = "";
            }
            else
            {
                item.cdt = ((System.DateTime)data.cdt).ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (data.udt == DateTime.MinValue)
            {
                item.udt = "";
            }
            else
            {
                item.udt = ((System.DateTime)data.udt).ToString("yyyy-MM-dd HH:mm:ss");
            }
            return item;
        }
Exemple #2
0
 /// <summary>
 /// 删除一条Battery的记录数据
 /// </summary>
 /// <param name="obj">删除的Battery结构,关键传入BatteryVC信息</param> 
 public void DeleteBattery(BatteryDef obj)
 {
     try
     {
         IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         OlymBatteryInfo item = itemRepository.FindBattery(obj.BatteryVC);
         if (item != null)
         {
             itemRepository.RemoveBattery(item);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
    protected void btnDelete_ServerClick(Object sender, EventArgs e)
    {

        string oldBatteryVC = this.dOldBatteryVC.Value.Trim();
        try
        {
            BatteryDef item = new BatteryDef();
            item.BatteryVC = oldBatteryVC;
            item.Hssn = "";
            item.Editor = "";            
            iBattery.DeleteBattery(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowBatteryListByVC();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "DealHideWait();DeleteComplete();", true);

    }
Exemple #4
0
        /// <summary>
        /// 保存一条Battery的记录数据(update), 若BatteryVC名称与其他存在的BatteryVC的名称相同,则提示业务异常
        /// </summary>
        /// <param name="obj">更新的Battery结构</param>
        /// <param name="oldBattery">修改前BatteryVC</param>
        public void UpdateBattery(BatteryDef obj, string oldBattery)
        {
            try
            {
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();

                //若BatteryVC名称与其他存在的BatteryVC的名称相同,则提示业务异常
                IList<OlymBatteryInfo> exists = itemRepository.GetExistBattery(obj.BatteryVC);
                if (exists != null && exists.Count > 0 && oldBattery != obj.BatteryVC)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT070", erpara);
                    throw ex;
                }
                OlymBatteryInfo itemOld = itemRepository.FindBattery(oldBattery);
                if (itemOld == null)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT082", erpara);
                    throw ex;
                }
                OlymBatteryInfo item = new OlymBatteryInfo();
                item.hppn = obj.BatteryVC;
                item.hssn = obj.Hssn;
                item.editor = obj.Editor;
                item.cdt = DateTime.Now;
                item.udt = DateTime.Now;
                itemRepository.ChangeBattery(item, oldBattery);
            }
            catch (Exception)
            {
                throw;
            }

        }
Exemple #5
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        BatteryDef item = new BatteryDef();

        string batteryVC = this.dBatteryVC.Text.Trim().ToUpper();
        string hssn = this.dHssn.Text.Trim().ToUpper();
        item.BatteryVC = batteryVC;
        item.Hssn = hssn;
        item.Editor = this.HiddenUserName.Value;
        
        try
        {
            iBattery.AddBattery(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowBatteryListByVC();
        batteryVC = replaceSpecialChart(batteryVC);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "DealHideWait();AddUpdateComplete('" + batteryVC + "');", true);
    }