Esempio n. 1
0
        public IList<ECOModelInfo> SaveECOModelChange(ECOModelInfo item)
		{
			string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                ECOModel items = new ECOModel();
                string preStatus = item.PreStatus;
                string model = item.Model;
                items.Udt = DateTime.Now;
                items.PreStatus = preStatus;
                items.Status = item.Status;
                items.Remark = item.Remark;
                items.Editor = item.Editor;
                items.Cdt = item.Cdt;
                items.Plant = item.Plant;
                items.ValidateFromDate = item.ValidateFromDate;
                items.ECONo = item.ECONo;
                items.ECRNo = item.ECRNo;
                items.Model = model;
                items.ID = item.ID;
                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<ECOModel> ecoModelRep = new Repository<ECOModel>("HPIMESDB");
                    IRepository<ConstValueType> constValueTypeRep = new Repository<ConstValueType>("HPIMESDB");
                    IList<ConstValueType> constvaluetemp = new List<ConstValueType>();
                    if (preStatus == "HoldTravelCard")
                    {
                        constvaluetemp = (from q in constValueTypeRep.Query()
                                          where q.Type == "HolTravelCardModel"
                                          && q.Value.Contains(model)
                                          select q).ToList();
                        if (constvaluetemp.Count != 0)
                        {
                            constValueTypeRep.Delete(constvaluetemp[0], false);
                        }
                    }
                    ecoModelRep.Update(items);
                    uow.Commit();
                }
                return GetECOModelList(item.ID);
            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
		}
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string id = this.hidID.Value;
         string changeStatus = this.cmbChangeStatus.SelectedValue;
         string remark = this.txtRemark.Value.Trim();
         IList<ECOModelInfo> ecoModellist = iFA_ECOModelQuery.GetECOModelList(int.Parse(id));
         ECOModelInfo item = new ECOModelInfo();
         //item = ecoModellist[0];
         //ECOModel item = new ECOModel();
         item.Udt = DateTime.Now;
         item.PreStatus = ecoModellist[0].Status;
         item.Status = changeStatus;
         item.Remark = remark;
         item.Editor = Master.userInfo.UserId;
         item.Cdt = ecoModellist[0].Cdt;
         item.Plant = ecoModellist[0].Plant;
         item.ValidateFromDate = ecoModellist[0].ValidateFromDate;
         item.ECONo = ecoModellist[0].ECONo;
         item.ECRNo = ecoModellist[0].ECRNo;
         item.Model = ecoModellist[0].Model;
         item.ID = ecoModellist[0].ID;
         IList<ECOModelInfo> list = iFA_ECOModelQuery.SaveECOModelChange(item);
         DataTable dt = ListToDataTable(list);
         if (dt.Rows.Count > 0)
         {
             gvResult.DataSource = dt;
             gvResult.DataBind();
             InitGridView();
             //EnableBtnExcel(this, true, btnExport.ClientID);
         }
         else
         {
             BindNoData();
             showErrorMessage("Not Found Any Information!!");
         }
     }
     catch (Exception ex)
     {
         showErrorMessage(ex.Message);
         BindNoData();
     }
     finally
     {
         endWaitingCoverDiv(this);
     }
 }