Example #1
0
        public List <GetGroupModel> getGroupList(int clientID)
        {
            List <GetGroupModel> list = new List <GetGroupModel>();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ClientID", clientID)
            };
            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("uspGET_GroupByClient", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        GetGroupModel model = new GetGroupModel();
                        model.GroupID  = Convert.ToInt32(row["GroupID"]);
                        model.ClientID = Convert.ToInt32(row["ClientID"]);
                        model.Name     = row["Name"].ToString();
                        model.Comment  = row["Comment"].ToString();
                        list.Add(model);
                    }
                }
            }
            return(list);
        }
Example #2
0
        protected void btnGroup_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlClient.SelectedValue != "0" && txtGroupName.Text != "" && txtComments.Text != "")
                {
                    GetGroupModel model = new GetGroupModel();
                    model.ClientID = Convert.ToInt32(ddlClient.SelectedValue);
                    model.Name     = txtGroupName.Text;
                    model.Comment  = txtComments.Text;

                    if (btnGroup.Text == "Save")
                    {
                        model.GroupID = 0;
                        bool exist = obj.groupExist(model.Name);
                        if (exist == false)
                        {
                            bool status = obj.postGroup(model);
                            if (status == true)
                            {
                                alert = AlertsClass.SuccessAdd;
                            }
                            else
                            {
                                alert = AlertsClass.ErrorWentWrong;
                            }
                        }
                        else
                        {
                            alert = AlertsClass.ErrorExist("Branch");
                        }
                    }
                    if (btnGroup.Text == "Update")
                    {
                        model.GroupID = Convert.ToInt32(Session["GroupId"]);
                        bool status = obj.postGroup(model);
                        if (status == true)
                        {
                            alert = AlertsClass.SuccessUpdate;
                        }
                        else
                        {
                            alert = AlertsClass.ErrorWentWrong;
                        }
                    }
                }
                else
                {
                    alert = AlertsClass.ErrorRequired;
                }
                clearControls();
                gridBind();
                allowStaticMethods("ALerts('" + alert + "'); ApplyDatatable('.gvdGroupClass'); staticMethod('Disable');");
            }
            catch (Exception)
            { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
        }
Example #3
0
 public bool postGroup(GetGroupModel _object)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@GroupID", _object.GroupID),
         new SqlParameter("@ClientID", _object.ClientID),
         new SqlParameter("@Name", _object.Name),
         new SqlParameter("@Comment", _object.Comment),
     };
     return(DBHelper.ExecuteNonQuery("uspPOST_Group", CommandType.StoredProcedure, parameters));
 }
        public GetGroupModel GroupBind(Group group)
        {
            GetGroupModel groupModel = new GetGroupModel();

            groupModel.id              = group.Id;
            groupModel.DisplayName     = group.DisplayName;
            groupModel.Description     = group.Description;
            groupModel.MailNickname    = group.MailNickname;
            groupModel.groupTypes      = group.GroupTypes.ToList();
            groupModel.mail            = group.Mail;
            groupModel.visibility      = group.Visibility;
            groupModel.createdDateTime = (group.CreatedDateTime).Value.UtcDateTime;

            groupModel.SecurityEnabled = group.SecurityEnabled;

            return(groupModel);
        }
Example #5
0
 protected void linkbtnEdit_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "UpdateID")
         {
             allowStaticMethods("applyDatatable('.gvdGroupClass');  staticMethod('Enable');");
             int           cmdArg = Convert.ToInt32(e.CommandArgument);
             GetGroupModel li     = obj.getGroupByGroupID(cmdArg);
             txtComments.Text        = li.Comment;
             txtGroupName.Text       = li.Name;
             ddlClient.SelectedValue = li.ClientID.ToString();
             gridBind();
             Session["GroupId"] = cmdArg.ToString();
             btnGroup.Text      = "Update";
         }
     }
     catch (Exception)
     { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); }
 }
Example #6
0
        public GetGroupModel getGroupByGroupID(int groupID)
        {
            GetGroupModel model = new GetGroupModel();
            string        query = "select * from [Group] where GroupID = @GroupID";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@GroupID", groupID),
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand(query, CommandType.Text, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    model.ClientID = Convert.ToInt32(row["ClientID"]);
                    model.Name     = row["Name"].ToString();
                    model.Comment  = row["Comment"].ToString();
                }
            }
            return(model);
        }
Example #7
0
 public bool postGroup(GetGroupModel _object)
 {
     return(obj.postGroup(_object));
 }