Пример #1
0
        protected void btnAddMethod_Click(object sender, EventArgs e)
        {
            using (Medappz2_LiveEntities l = new Medappz2_LiveEntities())
            {

                var MethodName = txtMethodName.Text.Trim();
                long pkID = -1;
                var className = txtClassName.Text.Trim();
                if (btnAddMethod.Text == "Update Method")
                {

                    var SelectedId= Convert.ToInt64(grdMethods.SelectedDataKey.Value);
                    var ObjMethod = (from vObj in l.L_SECU_ALL_METHODS where vObj.PK_ID == SelectedId select vObj).FirstOrDefault();

                  ///  var ObjMethod = getMethodObj(SelectedId);
                    if(ObjMethod != null)
                    {
                        pkID = ObjMethod.PK_ID;
                        ObjMethod.CLASS_NAME = className;
                        ObjMethod.METHOD_NAME = MethodName;
                    }
                    l.SaveChanges();
                }
                else
                {
                    var ObjMethod = (from vObj in l.L_SECU_ALL_METHODS where vObj.METHOD_NAME == MethodName  select vObj).FirstOrDefault();
                    if (ObjMethod == null)
                    {
                        var objNewMethod = new L_SECU_ALL_METHODS()
                        {
                            //  FK_CONFIG_ID = sectionId,
                            ROW_STATUS = 1,
                            METHOD_NAME = MethodName,
                            CLASS_NAME = className
                        };
                        l.L_SECU_ALL_METHODS.AddObject(objNewMethod);
                        l.SaveChanges();
                        pkID = objNewMethod.PK_ID;
                    }
                    else
                    {
                        lblErrorMessage.Text = "Method already exists";
                    }
                }
                txtMethodName.Text = "";
                txtClassName.Text = "";
                if (pkID > 0)
                {
                    ucMethodArgumentComparator1.SaveComparator(pkID);
                }
            }
            ucMethodArgumentComparator1.resetComparator();
            ucMethodArgumentComparator1.bindComparator(-1);
            BindGrid();
            grdMethods.SelectedIndex = -1;
        }
Пример #2
0
 /// <summary>
 /// Create a new L_SECU_ALL_METHODS object.
 /// </summary>
 /// <param name="pK_ID">Initial value of the PK_ID property.</param>
 /// <param name="mETHOD_NAME">Initial value of the METHOD_NAME property.</param>
 /// <param name="rOW_STATUS">Initial value of the ROW_STATUS property.</param>
 public static L_SECU_ALL_METHODS CreateL_SECU_ALL_METHODS(global::System.Int64 pK_ID, global::System.String mETHOD_NAME, global::System.Int32 rOW_STATUS)
 {
     L_SECU_ALL_METHODS l_SECU_ALL_METHODS = new L_SECU_ALL_METHODS();
     l_SECU_ALL_METHODS.PK_ID = pK_ID;
     l_SECU_ALL_METHODS.METHOD_NAME = mETHOD_NAME;
     l_SECU_ALL_METHODS.ROW_STATUS = rOW_STATUS;
     return l_SECU_ALL_METHODS;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the L_SECU_ALL_METHODS EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToL_SECU_ALL_METHODS(L_SECU_ALL_METHODS l_SECU_ALL_METHODS)
 {
     base.AddObject("L_SECU_ALL_METHODS", l_SECU_ALL_METHODS);
 }