public List <ObjectGroupModel> getObjectGroupByObject(int objectID)
        {
            List <ObjectGroupModel> list = new List <ObjectGroupModel>();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ObjectID", objectID),
            };
            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("uspGET_ObjectGroupByObject", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        ObjectGroupModel model = new ObjectGroupModel();
                        model.ObjectGroupID = Convert.ToInt32(row["ObjectGroupID"]);
                        model.ObjectName    = row["ObjectName"].ToString();
                        model.GroupName     = row["GroupName"].ToString();
                        model.ObjectID      = Convert.ToInt32(row["ObjectID"]);
                        model.GroupID       = Convert.ToInt32(row["GroupID"]);
                        list.Add(model);
                    }
                }
            }
            return(list);
        }
 public bool postObjectGroup(ObjectGroupModel _object)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@ObjectGroupID", _object.ObjectGroupID),
         new SqlParameter("@ObjectID", _object.ObjectID),
         new SqlParameter("@GroupID", _object.GroupID),
     };
     return(DBHelper.ExecuteNonQuery("uspPOST_ObjectGroup", CommandType.StoredProcedure, parameters));
 }
Exemple #3
0
        public ObjectGroupModel GetObjectGroup(int ObjectGroupId)
        {
            var    url    = "api/ObjectGroup/" + ObjectGroupId;
            string result = SC.Getcaller(url);

            if (result != null)
            {
                ObjectGroupModel _client = JsonConvert.DeserializeObject <ObjectGroupModel>(result);
                return(_client);
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
        protected void btnAddObjectGroup_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlClient.SelectedValue != "0" && ddlGroup.SelectedValue != "0" && ddlObject.SelectedValue != "0")
                {
                    ObjectGroupModel model = new ObjectGroupModel();
                    model.ObjectID = Convert.ToInt32(ddlObject.SelectedValue);
                    model.GroupID  = Convert.ToInt32(ddlGroup.SelectedValue);

                    if (btnAddObjectGroup.Text == "Save")
                    {
                        model.ObjectGroupID = 0;
                        bool status = obj.postObjectGroup(model);
                        if (status == true)
                        {
                            Alert = AlertsClass.SuccessAdd;
                        }
                        else
                        {
                            Alert = AlertsClass.ErrorWentWrong;
                        }
                    }

                    if (btnAddObjectGroup.Text == "Update")
                    {
                        model.ObjectGroupID = Convert.ToInt32(Session["objectGroupId"]);
                        bool status = obj.postObjectGroup(model);
                        if (status == true)
                        {
                            Alert = AlertsClass.SuccessAdd;
                        }
                        else
                        {
                            Alert = AlertsClass.ErrorWentWrong;
                        }
                    }
                }
                else
                {
                    Alert = AlertsClass.ErrorRequired;
                }
                BindingClass.CallScriptManager(this.Page, this.GetType(), "ALerts('" + Alert + "'); applyDatatable('.gvdObjectGroupClass');staticMethod('Disable');");
            }
            catch (Exception)
            { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
        }
Exemple #5
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             BindingClass.CallScriptManager(this, this.GetType(), "applyDatatable('.gvdObjectGroupClass'); staticMethod('Enable');");
             int ID = Convert.ToInt32(e.CommandArgument);
             ObjectGroupModel li = obj.getObjectGroupByID(ID);
             ddlObject.SelectedValue  = li.ObjectID.ToString();
             ddlGroup.SelectedValue   = li.GroupID.ToString();
             Session["objectGroupId"] = ID.ToString();
             btnAddObjectGroup.Text   = "Update";
             gridBind();
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
        public ObjectGroupModel getObjectGroupByID(int objectGroupID)
        {
            ObjectGroupModel model = new ObjectGroupModel();
            string           query = "select * from [ObjectGroup] where ObjectGroupID = @ObjectGroupID";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ObjectGroupID", objectGroupID),
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand(query, CommandType.Text, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    model.ObjectGroupID = Convert.ToInt32(row["ObjectGroupID"]);
                    model.ObjectID      = Convert.ToInt32(row["ObjectID"]);
                    model.GroupID       = Convert.ToInt32(row["GroupID"]);
                }
            }
            return(model);
        }
 public bool postObjectGroup(ObjectGroupModel _object)
 {
     return(obj.postObjectGroup(_object));
 }