public IList<FamilyInfoNameEx> GetFamilyInfoName() { try { IList<FamilyInfoNameEx> ret = new List<FamilyInfoNameEx>(); string SQLStatement = "Select Name, Description, Editor, Cdt, Udt from FamilyInfoName NOLOCK"; using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_GetData, CommandType.Text, SQLStatement)) { while (sqlR != null && sqlR.Read()) { FamilyInfoNameEx item = new FamilyInfoNameEx(); item.Name = GetValue_Str(sqlR, 0); item.Description = GetValue_Str(sqlR, 1); item.Editor = GetValue_Str(sqlR, 2); item.Cdt =GetValue_DateTime(sqlR,3); item.Udt =GetValue_DateTime(sqlR,4); ret.Add(item); } } return ret; } catch (Exception) { throw; } }
public void UpdateFamilyInfoName(FamilyInfoNameEx item, string nameKey) { try { _Schema.SQLContext sqlCtx = null; lock (MethodBase.GetCurrentMethod()) { if (!_Schema.Func.PeerTheSQL(MethodBase.GetCurrentMethod().MetadataToken, out sqlCtx)) { sqlCtx = new _Schema.SQLContext(); sqlCtx.Sentence = @"update FamilyInfoName set Name =@Name, Description = @Descr, Editor = @Editor, Udt =@Now where Name=@NameKey"; sqlCtx.Params.Add("Name", new SqlParameter("@Name", SqlDbType.VarChar)); sqlCtx.Params.Add("Descr", new SqlParameter("@Descr", SqlDbType.VarChar)); sqlCtx.Params.Add("Editor", new SqlParameter("@Editor", SqlDbType.VarChar)); sqlCtx.Params.Add("Now", new SqlParameter("@Now", SqlDbType.DateTime)); sqlCtx.Params.Add("NameKey", new SqlParameter("@NameKey", SqlDbType.VarChar)); _Schema.Func.InsertIntoCache(MethodBase.GetCurrentMethod().MetadataToken, sqlCtx); } } sqlCtx.Params["Name"].Value = item.Name; sqlCtx.Params["Descr"].Value = item.Description; sqlCtx.Params["Editor"].Value = item.Editor; sqlCtx.Params["Now"].Value = _Schema.SqlHelper.GetDateTime(); sqlCtx.Params["NameKey"].Value = nameKey; _Schema.SqlHelper.ExecuteNonQuery(_Schema.SqlHelper.ConnectionString_GetData, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params.Values.ToArray<SqlParameter>()); } catch (Exception) { throw; } }
public void UpdateSelectedFamilyInfoName(FamilyInfoNameEx item, string nameKey) { IFamilyRepositoryEx itemRepositoryEx = RepositoryFactory.GetInstance().GetRepository<IFamilyRepositoryEx>(); itemRepositoryEx.UpdateFamilyInfoName(item, nameKey); }
public void AddFamilyInfoName(FamilyInfoNameEx item) { IFamilyRepositoryEx itemRepositoryEx = RepositoryFactory.GetInstance().GetRepository<IFamilyRepositoryEx>(); itemRepositoryEx.AddFamilyInfoName(item); }
protected void btnSave_Click(Object sender, EventArgs e) { string name = txtName.Text.Trim(); string desc = txtDesc.Text; string modelInfoNameId = hidModelInfoNameId.Value; bool bExist = false; try { if ("".Equals(name)) { showErrorMessage(this.GetLocalResourceObject(Pre + "_msgAddSave").ToString()); return; } if (!hidModelInfoNameId.Value.Equals(name)) { IList<FamilyInfoNameEx> modelinfoNamelist = iFamilyInfoName.GetFamilyInfoName(); if (modelinfoNamelist != null && modelinfoNamelist.Count != 0) { foreach (FamilyInfoNameEx temp in modelinfoNamelist) { if (name.Equals(temp.Name)) { bExist = true; break; } } } if (bExist) { showErrorMessage(this.GetLocalResourceObject(Pre + "_msgNameExist").ToString()); return; } } FamilyInfoNameEx model = new FamilyInfoNameEx(); model.Name = name; model.Description = desc; model.Editor = editor; iFamilyInfoName.UpdateSelectedFamilyInfoName(model, hidModelInfoNameId.Value); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } bindTable(); ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "SaveComplete", "SaveComplete(\"" + modelInfoNameId + "\");", true); }