public ActionResult SubjectsAddEdit(LanguagesDto item, string headerObjId) { var modelRepo = db.LanguageBases; var exists = modelRepo.Where(c => c.ObjId == item.ObjId).SingleOrDefault(); LanguageBase Tosave = new LanguageBase(); Tosave.LangauageId = item.LanguageId; if (exists == null) { CopyProperties(item, Tosave); modelRepo.Add(Tosave); db.SaveChanges(); } if (exists != null) { CopyProperties(item, exists); this.UpdateModel(exists); // modelRepo.Attach(exists); db.SaveChanges(); } var BurialRecords = GetLanguagesDto(); // DXCOMMENT: Pass a data model for GridView in the PartialView method's second parameter return(PartialView("_SubjectsGridViewPartial", BurialRecords)); }
/// <summary> /// Add common parameters before calling a procedure /// </summary> /// <param name="cmd">command object, where parameters will be added</param> /// <param name="languageObject"></param> private void AddCommonParams(SqlCommand cmd, LanguageBase languageObject) { AddParameter(cmd, pGuid(LanguageBase.Property_CompanyId, languageObject.CompanyId)); AddParameter(cmd, pNVarChar(LanguageBase.Property_Name, 100, languageObject.Name)); AddParameter(cmd, pNVarChar(LanguageBase.Property_LanguageCulture, 20, languageObject.LanguageCulture)); AddParameter(cmd, pBool(LanguageBase.Property_Rtl, languageObject.Rtl)); AddParameter(cmd, pBool(LanguageBase.Property_Published, languageObject.Published)); AddParameter(cmd, pInt32(LanguageBase.Property_DisplayOrder, languageObject.DisplayOrder)); }
void Start() { if (l == null) { l = this; } else { Destroy(this); } dataPath = Application.dataPath + "\\"; Load(Language.eng); }
/// <summary> /// Fills Language object /// </summary> /// <param name="languageObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> /// <param name="start">The ordinal position from which to start reading the reader</param> protected void FillObject(LanguageBase languageObject, SqlDataReader reader, int start) { languageObject.Id = reader.GetInt32(start + 0); languageObject.CompanyId = reader.GetGuid(start + 1); languageObject.Name = reader.GetString(start + 2); languageObject.LanguageCulture = reader.GetString(start + 3); languageObject.Rtl = reader.GetBoolean(start + 4); languageObject.Published = reader.GetBoolean(start + 5); languageObject.DisplayOrder = reader.GetInt32(start + 6); FillBaseObject(languageObject, reader, (start + 7)); languageObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; }
internal static void SetLanguage(string langName) { if (string.IsNullOrWhiteSpace(langName)) { langName = System.Globalization.CultureInfo.InstalledUICulture.TwoLetterISOLanguageName; } switch (langName) { case "ru": Current = new Russian(); break; case "en": default: Current = new English(); break; } }
public static string GetContent(string ID) { LanguageBase tmp = LanguageBaseManager.instance.Find(ID); if (tmp == null) { Util.LogError("Can't find ID:{0} in Language.csv", ID); return(""); } if (AppConst.Language == 1) { string str = tmp.chinese.Replace("/n", "\n\r"); return(str); } if (AppConst.Language == 2) { string str = tmp.english.Replace("/n", "\n\r"); return(str); } }
/// <summary> /// Updates Language /// </summary> /// <param name="languageObject">Object to be updated</param> /// <returns>Number of rows affected</returns> public long Update(LanguageBase languageObject) { try { SqlCommand cmd = GetSPCommand(UPDATELANGUAGE); AddParameter(cmd, pInt32(LanguageBase.Property_Id, languageObject.Id)); AddCommonParams(cmd, languageObject); long result = UpdateRecord(cmd); if (result > 0) { languageObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; } return(result); } catch (SqlException x) { throw new ObjectUpdateException(languageObject, x); } }
/// <summary> /// Inserts Language /// </summary> /// <param name="languageObject">Object to be inserted</param> /// <returns>Number of rows affected</returns> public long Insert(LanguageBase languageObject) { try { SqlCommand cmd = GetSPCommand(INSERTLANGUAGE); AddParameter(cmd, pInt32Out(LanguageBase.Property_Id)); AddCommonParams(cmd, languageObject); long result = InsertRecord(cmd); if (result > 0) { languageObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; languageObject.Id = (Int32)GetOutParameter(cmd, LanguageBase.Property_Id); } return(result); } catch (SqlException x) { throw new ObjectInsertException(languageObject, x); } }
public static void LoadLanguage(string aName, IMainForm parent, bool ShowError) { if (aName == "English") { Language = new LanguageBase(); Settings.Settings.Language = "English"; parent.ChangeLanguage(); return; } try { Assembly pluginAssembly = Assembly.LoadFrom(Path + "\\Languages\\" + aName + ".dll"); Type[] types = pluginAssembly.GetTypes(); foreach (Type type in types) { if (type.Name.Equals("Language")) { Language = (LanguageBase)pluginAssembly.CreateInstance(type.FullName); } } pluginAssembly = null; } catch (FileNotFoundException ex) { if (ShowError) { MessageBox.Show(ex.Message, "Error"); } Language = new LanguageBase(); Settings.Settings.Language = "English"; parent.ChangeLanguage(); return; } Settings.Settings.Language = aName; parent.ChangeLanguage(); }
/// <summary> /// Fills Language object /// </summary> /// <param name="languageObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> protected void FillObject(LanguageBase languageObject, SqlDataReader reader) { FillObject(languageObject, reader, 0); }