protected void btnAdd_ServerClick(object sender,EventArgs e) { GradeInfo grade = new GradeInfo(); grade.family = this.ddlFamily.InnerDropDownList.SelectedValue; grade.grade = this.ddlGrade.InnerDropDownList.SelectedValue; grade.series = this.ttSeries.Text.Trim(); grade.energia = this.ttEnergia.Text.Trim(); grade.espera = this.ttEspera.Text.Trim(); grade.editor = this.HiddenUserName.Value.Trim(); string itemId=""; try { itemId = iGrade.AddSelectedGrade(grade); } catch(FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch(Exception ex) { showErrorMessage(ex.Message); return; } showListByGradeList(); itemId = replaceSpecialChart(itemId); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');HideWait();", true); }
public string AddSelectedGrade(GradeInfo grade) { string id = null; IList<GradeInfo> gradeLst = new List<GradeInfo>(); try { if (grade == null) { //throw exception; } else { gradeLst = (IList<GradeInfo>)itemRepository.GetAllGrades(); foreach (GradeInfo info in gradeLst) { FisException ex; if (info.family == grade.family && info.series == grade.series && info.grade == grade.grade) { List<string> param = new List<string>(); ex = new FisException("DMT074", param); throw ex; } } itemRepository.AddSelectedGrade(grade); id=Convert.ToString(grade.id); } } catch(Exception e) { logger.Error(e.Message); throw e; } return id; }
public void UpdateSelectedGrade(GradeInfo newItem) { try { gradeLst = (IList<GradeInfo>)itemRepository.GetAllGrades(); Boolean duplicateFlag = false, notExistFlag = true; FisException ex=null; foreach (GradeInfo info in gradeLst) { if(info.id==newItem.id) { notExistFlag=false; } if (info.id!=newItem.id&&info.family == newItem.family && info.series == newItem.series && info.grade == newItem.grade) { duplicateFlag = true; } } if (notExistFlag) { List<string> param = new List<string>(); ex = new FisException("DMT083", param); throw ex; } else if (duplicateFlag) { List<string> param = new List<string>(); ex = new FisException("DMT074", param); throw ex; } newItem.udt = DateTime.Now; itemRepository.UpdateSelectedGrade(newItem); } catch(Exception e) { logger.Error(e.Message); throw e; } }
public void UpdateSelectedGradeDefered(IUnitOfWork uow, GradeInfo item) { InvokeBody.AddOneInvokeBody(this, uow, MethodBase.GetCurrentMethod(), item); }
public void UpdateSelectedGrade(GradeInfo item) { try { MethodBase mthObj = MethodBase.GetCurrentMethod(); int tk = mthObj.MetadataToken; SQLContextNew sqlCtx = null; lock (mthObj) { if (!SQLCache.PeerTheSQL(tk, out sqlCtx)) { sqlCtx = FuncNew.GetCommonUpdate<Hp_Grade>(tk); } } sqlCtx = FuncNew.SetColumnFromField<Hp_Grade, GradeInfo>(sqlCtx, item); DateTime cmDt = _Schema.SqlHelper.GetDateTime(); sqlCtx.Param(Hp_Grade.fn_udt).Value = cmDt; _Schema.SqlHelper.ExecuteNonQuery(_Schema.SqlHelper.ConnectionString_PAK, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params); } catch (Exception) { throw; } }
protected void btnSave_ServerClick(object sender, EventArgs e) { //init oldGrade; string oldfamily = this.dOldFamilyId.Value.Trim(); string oldseries = this.dOldSeries.Value.Trim(); string oldgrade = this.dOldGrade.Value.Trim(); GradeInfo oldGrade = new GradeInfo(); oldGrade.family = oldfamily; oldGrade.series = oldseries; oldGrade.grade = oldgrade; //init newGrade string family = this.ddlFamily.InnerDropDownList.SelectedValue.Trim(); string grade = this.ddlGrade.InnerDropDownList.SelectedValue.Trim(); string series = this.ttSeries.Text.Trim(); string energia = this.ttEnergia.Text.Trim(); string espera = this.ttEspera.Text.Trim(); GradeInfo newGrade = new GradeInfo(); newGrade.family = family; newGrade.grade = grade; newGrade.series = series; newGrade.energia = energia; newGrade.espera = espera; newGrade.editor = this.HiddenUserName.Value.Trim(); newGrade.id = Convert.ToInt32(this.HiddenSelectedId.Value.Trim()); string itemId = this.HiddenSelectedId.Value.Trim(); try { iGrade.UpdateSelectedGrade(newGrade); } catch(FisException fe) { showErrorMessage(fe.mErrmsg); return; } catch(Exception ee) { showErrorMessage(ee.Message); return; } showListByGradeList(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');HideWait();", true); }