コード例 #1
0
        private void iAddParameter_Click(object sender, EventArgs e)
        {
            fwk_Param parent = null;

            if (_param.ParentId.HasValue)
            {
                parent = _AllParams.Where(p => p.ParamId.Equals(_param.ParentId.Value)).FirstOrDefault <fwk_Param>();
            }

            using (frmAddParam frm = new frmAddParam(parent))
            {
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        //TODO: Latter
                        MultilanguageDAC.Param_CreateNew(frm.Param);
                    }
                    catch (Exception ex)
                    {
                        this.ExceptionViewer.Show(ex);
                    }
                    this.Init();
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="culture">Lenguaje</param>
        /// <param name="parentId">Padre o tipo</param>
        /// <param name="paramId">Codigo de param o identificador</param>
        /// <param name="name"></param>
        internal static void Param_Update(fwk_Param param)
        {
            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                bool      wExist = false;
                fwk_Param record;

                //Verifico que clave y valor exista
                wExist = dc.fwk_Params.Any(p => p.Culture.Equals(param.Culture)
                                           //&& p.ParentId.Equals(param.ParentId)
                                           && p.Name.Equals(param.Name) &&
                                           p.ParamId.Equals(param.ParamId) == false);
                if (wExist)
                {
                    throw new Fwk.Exceptions.FunctionalException(String.Format("Ya existe la param {0} codig:{1} tipo {2} cultura:{2}", param.Name, param.ParamId, param.Culture));
                }
                else
                {
                    record             = dc.fwk_Params.Where(p => p.Id.Equals(param.Id)).FirstOrDefault <fwk_Param>();
                    record.Name        = param.Name;
                    record.ParamId     = param.ParamId;
                    record.ParentId    = param.ParentId;
                    record.Description = param.Description;
                    record.Culture     = param.Culture;



                    dc.SubmitChanges();
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="param"></param>
        internal static void Param_CreateNew(fwk_Param param)
        {
            Param_CreateNew_Validate_Existent(param);
            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                param.Enabled = true;
                dc.fwk_Params.InsertOnSubmit(param);

                dc.SubmitChanges();
            }
        }
コード例 #4
0
 /// <summary>
 /// Verifico si tiene algun hijo
 /// </summary>
 /// <param name="param"></param>
 internal static void Param_ValidateRemove(fwk_Param param)
 {
     using (ConfigDataContext dc = new ConfigDataContext(cnnString))
     {
         //Verifico si tiene algun hijo
         bool wExist = dc.fwk_Params.Any(p => p.ParentId.Equals(param.ParamId));
         if (wExist)
         {
             throw new Fwk.Exceptions.FunctionalException(String.Format("{0} es padre de otros en la Base de datos", param.Name));
         }
     }
 }
コード例 #5
0
        /// <summary>
        /// Verifico que clave y valor exista
        /// </summary>
        /// <param name="param"></param>
        internal static void Param_CreateNew_Validate_Existent(fwk_Param param)
        {
            Boolean wExist = false;

            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                wExist = dc.fwk_Params.Any(p => p.Culture.Equals(param.Culture) && p.ParamId.Equals(param.ParamId));

                if (wExist)
                {
                    param = dc.fwk_Params.Where(p => p.Culture.Equals(param.Culture) && p.ParamId.Equals(param.ParamId)).FirstOrDefault();
                    throw new Fwk.Exceptions.FunctionalException(String.Format("Ya existe la param {0} codigo: {1} tipo {2} cultura:{2}", param.Name, param.ParamId, param.Culture));
                }
            }
        }
コード例 #6
0
ファイル: frmAddParam.cs プロジェクト: Kmiiloberrio2/fwk_12
 public frmAddParam(fwk_Param parent)
 {
     _Parent = parent;
     InitializeComponent();
     if (_Parent != null)
     {
         lblPArentName.Text = parent.Name;
         lblParentId.Text   = parent.ParamId.ToString();
     }
     else
     {
         lblPArentName.Text = "";
         lblParentId.Text   = "Parametro sin  padre";
     }
     FillCulture();
 }
コード例 #7
0
        /// <summary>
        /// Verifico si existe un registros con los parametros asados.
        /// ParentId
        /// ParamId
        /// cultura
        /// </summary>
        /// <param name="culture">Lenguaje</param>
        /// <param name="parentId">Padre o tipo</param>
        /// <param name="paramId">ParamId o identificador</param>
        internal static void Param_ValidateUpdate(fwk_Param param)
        {
            using (ConfigDataContext dc = new ConfigDataContext(cnnString))
            {
                bool wExist = false;

                wExist = dc.fwk_Params.Any(p => p.Culture.Equals(param.Culture) &&
                                           p.ParentId.Equals(param.ParentId)
                                           //&& p.Name.Equals(param.Name)
                                           && p.ParamId.Equals(param.ParamId) == false);
                if (wExist)
                {
                    throw new Fwk.Exceptions.FunctionalException(String.Format("Ya existe la param {0} codig:{1} tipo {2} cultura:{2}", param.Name, param.ParamId, param.Culture));
                }
            }
        }
コード例 #8
0
ファイル: frmAddParam.cs プロジェクト: Kmiiloberrio2/fwk_12
        private void btnOk_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            if (String.IsNullOrEmpty(txtName.Text))
            {
                errorProvider1.SetError(txtName, "Ingrese el nobre de la clave");
                return;
            }
            int res = 0;

            Int32.TryParse(txtParamId.Text.Trim(), out res);
            if (res == 0)
            {
                errorProvider1.SetError(txtParamId, "Ingrese solo valores numericos para el codigo EJ: 1000, 2001, 89, etc ");
                return;
            }

            _Param         = new fwk_Param();
            _Param.ParamId = res;
            if (_Parent != null)
            {
                _Param.ParentId = _Parent.ParamId;
            }
            _Param.Name        = txtName.Text;
            _Param.Description = txtDescription.Text;
            String culture = comboBoxEdit1.Text.Trim().Split(',')[0];

            if (String.IsNullOrEmpty(culture))
            {
                culture = "es-AR";
            }
            _Param.Culture = culture.Trim();
            try
            {
                MultilanguageDAC.Param_CreateNew_Validate_Existent(_Param);
            }
            catch (Exception ex)
            {
                errorProvider1.SetError(txtParamId, ex.Message);
                //this.ExceptionViewer.Show(ex);
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
コード例 #9
0
        private void gridView_Params_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            _param = ((fwk_Param)gridView_Params.GetRow(e.RowHandle));
            if (_param == null)
            {
                return;
            }

            try
            {
                MultilanguageDAC.Param_ValidateUpdate(_param);
                MultilanguageDAC.Param_Update(_param);
                Init();
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }
        }
コード例 #10
0
        private void gridControl_Params_DoubleClick(object sender, EventArgs e)
        {
            if (_param == null)
            {
                return;
            }

            fwk_Param parent = null;

            if (_param.ParentId.HasValue)
            {
                parent = _AllParams.Where(p => p.ParamId.Equals(_param.ParentId.Value)).FirstOrDefault <fwk_Param>();
            }

            using (frmParamInfo frm = new frmParamInfo(parent, _param))
            {
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                }
            }
        }
コード例 #11
0
        internal static List <fwk_Param> Params_Retrive()
        {
            List <fwk_Param> list2 = new List <fwk_Param>();
            fwk_Param        param = null;
            var list = Fwk.Params.Back.ParamDAC.RetriveByParams(null, null, String.Empty, MultilanguageDAC.cnnStringName);

            foreach (ParamBE p in list)
            {
                param             = new fwk_Param();
                param.Culture     = p.Culture;
                param.ParamId     = p.ParamId;
                param.ParentId    = p.ParentId;
                param.Description = p.Description;
                param.Enabled     = p.Enabled;
                param.Id          = p.Id;
                param.Name        = p.Name;

                list2.Add(param);
            }
            return(list2);
        }
コード例 #12
0
ファイル: frmParamInfo.cs プロジェクト: Kmiiloberrio2/fwk_12
        public frmParamInfo(fwk_Param parent, fwk_Param param)
        {
            _Parent = parent;
            InitializeComponent();
            if (_Parent != null)
            {
                lblPArentName.Text = parent.Name;
                lblParentId.Text   = parent.ParamId.ToString();
            }
            else
            {
                lblPArentName.Text = "NA";
                lblParentId.Text   = "NA";
            }
            txtDescription.Text = param.Description;
            txtName.Text        = param.Name;
            txtParamId.Text     = param.ParamId.ToString();
            comboBoxEdit1.Text  = param.Culture;

            FillCulture();
        }
コード例 #13
0
        private void gridView_Params_MouseDown(object sender, MouseEventArgs e)
        {
            _GridHitInfoParam = gridView_Params.CalcHitInfo(new Point(e.X, e.Y));

            _param = ((fwk_Param)gridView_Params.GetRow(_GridHitInfoParam.RowHandle));
            if (_param == null)
            {
                return;
            }


            if (_GridHitInfoParam.RowHandle < 0)
            {
                addNewKeyToolStripMenuItem.Enabled = true;
                //removeSelectedsToolStripMenuItem.Enabled = false;
            }
            else
            {
                //removeSelectedsToolStripMenuItem.Enabled = true;
                addNewKeyToolStripMenuItem.Enabled = true;
            }
        }
コード例 #14
0
        private void iNewParamWithoutParent_Click(object sender, EventArgs e)
        {
            fwk_Param parent = null;


            using (frmAddParam frm = new frmAddParam(parent))
            {
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        //TODO: Latter
                        MultilanguageDAC.Param_CreateNew(frm.Param);
                    }
                    catch (Exception ex)
                    {
                        this.ExceptionViewer.Show(ex);
                    }
                    this.Init();
                }
            }
        }
コード例 #15
0
 partial void Deletefwk_Param(fwk_Param instance);
コード例 #16
0
 partial void Insertfwk_Param(fwk_Param instance);
コード例 #17
0
 partial void Updatefwk_Param(fwk_Param instance);