private void btnOk_Click(object sender, EventArgs e) { errorProvider1.Clear(); if (String.IsNullOrEmpty(txtKey.Text)) { errorProvider1.SetError(txtKey, "Ingrese el nobre de la clave"); return; } int res =0; Int32.TryParse(txtCode.Text.Trim(), out res); if (res == 0) { errorProvider1.SetError(txtCode, "Ingrese solo valores numericos para el codigo EJ: 1000, 2001, 89, etc "); return; } _Param = new ParamCampaing(); _Param.ParamCapaingId = res; _Param.Name = txtKey.Text; _Param.Remarks = txtRemark.Text; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
internal static void CreateNewParam(ParamCampaing param ,string relatedName, out string errMsg) { string language; errMsg = string.Empty; ParamCampaing record = null; Boolean wExist = false; using (ConfigDataContext dc = new ConfigDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[cnnStringNAme].ConnectionString)) { for (int i = 0; i < Fwk.Configuration.ConfigurationManager.ConfigProvider.Providers.Count; i++) { language = Fwk.Configuration.ConfigurationManager.ConfigProvider.Providers[i].Name; //Verifico que clave y valor exista wExist = dc.ParamCampaings.Any(p => p.Language.Equals(language) && p.ParamCampaingIdRelated.Equals(param.ParamCampaingIdRelated) && p.ParamCapaingId.Equals(param.ParamCapaingId)); if (wExist) { errMsg = String.Format("Ya existe la param {0} codig:{1} en el grupo {2} para alguno de los lenguajes", param.Name,param.ParamCapaingId, relatedName); return; } else { record = new ParamCampaing(); record.Language = language; record.ParamCampaingIdRelated = param.ParamCampaingIdRelated; record.ParamCapaingId = param.ParamCapaingId; record.Name = param.Name; record.Remarks = param.Remarks; dc.ParamCampaings.InsertOnSubmit(record); } dc.SubmitChanges(); } } }
/// <summary> /// /// </summary> /// <param name="language">Lenguaje</param> /// <param name="paramCampaingIdRelated">Padre o tipo</param> /// <param name="paramCapaingId">Codigo de param o identificador</param> /// <param name="name"></param> internal static void CreateORUpdate_Param(string language, int paramCampaingIdRelated, int paramCapaingId, string name) { using (ConfigDataContext dc = new ConfigDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["bb"].ConnectionString)) { bool wExist = false; ParamCampaing record; //Verifico que clave y valor exista wExist = dc.ParamCampaings.Any(p => p.Language.Equals(language) && p.ParamCampaingIdRelated.Equals(paramCampaingIdRelated) && p.ParamCapaingId.Equals(paramCapaingId)); if (wExist) { record = dc.ParamCampaings.Where(p => p.Language.Equals(language) && p.ParamCampaingIdRelated.Equals(paramCampaingIdRelated) && p.ParamCapaingId.Equals(paramCapaingId)).FirstOrDefault<ParamCampaing>(); record.Name = name;// e.Value.ToString().Trim(); } else { record = new ParamCampaing(); record.Language = language; record.ParamCapaingId = paramCapaingId; record.ParamCampaingIdRelated = paramCampaingIdRelated; //record.Remarks = ""; record.Name = name; dc.ParamCampaings.InsertOnSubmit(record); } dc.SubmitChanges(); } }
partial void DeleteParamCampaing(ParamCampaing instance);
partial void UpdateParamCampaing(ParamCampaing instance);
partial void InsertParamCampaing(ParamCampaing instance);