public static List <ATTGroup> GetGroupList(int?orgID, bool ContainDefault, char type)
        {
            try
            {
                List <ATTGroup> lstGroup = new List <ATTGroup>();

                DataTable tbl = DLLGroup.GetGroupListTable(orgID, type);

                foreach (DataRow row in tbl.Rows)
                {
                    ATTGroup objGroup = new ATTGroup(int.Parse(row["ORG_ID"].ToString()),
                                                     int.Parse(row["GROUP_ID"].ToString()),
                                                     row["GROUP_NAME"].ToString(),
                                                     row["DESCRIPTION"].ToString(),
                                                     row["ACTIVE"].ToString()
                                                     );

                    lstGroup.Add(objGroup);
                }

                if (ContainDefault == true && lstGroup.Count > 0)
                {
                    lstGroup.Insert(0, new ATTGroup(0, 0, "------ Select Group ------", "", ""));
                }

                return(lstGroup);
            }
            catch (Exception ex)
            {
                throw(ex);
            }
        }
 public static bool AddGroup(ATTGroup obj)
 {
     try
     {
         DLLGroup.AddGroup(obj);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static ObjectValidation Validate(ATTGroup obj)
        {
            ObjectValidation result = new ObjectValidation();

            if (obj.GroupName.Trim() == "")
            {
                result.IsValid      = false;
                result.ErrorMessage = "Group name cannot be blank";
                return(result);
            }

            return(result);
        }
예제 #4
0
    protected void lstCommittee_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.ddlOrg.SelectedIndex = 0;
        this.txtCommittee.Text    = "";
        this.txtDescription.Text  = "";
        this.chkActive.Checked    = false;

        ATTGroup obj = ((List <ATTGroup>)Session["GroupLst"])[this.lstCommittee.SelectedIndex];

        this.ddlOrg.SelectedValue = obj.OrgID.ToString();
        this.txtCommittee.Text    = obj.GroupName;
        this.txtDescription.Text  = obj.Description;
        this.chkActive.Checked    = (obj.Active == "Y") ? true : false;
    }
        public static List <ATTGroup> GetGroupListWithMember(int?orgID, bool ContainDefault, char type)
        {
            try
            {
                List <ATTGroupMember> lstGM = BLLGroupMember.GetGroupMemberList(null);

                List <ATTGroup> lstGroup = new List <ATTGroup>();

                foreach (DataRow row in DLLGroup.GetGroupListTable(orgID, type).Rows)
                {
                    ATTGroup objGroup = new ATTGroup(int.Parse(row["ORG_ID"].ToString()),
                                                     int.Parse(row["GROUP_ID"].ToString()),
                                                     row["GROUP_NAME"].ToString(),
                                                     row["DESCRIPTION"].ToString(),
                                                     row["ACTIVE"].ToString()
                                                     );

                    objGroup.LstGroupMember = lstGM.FindAll
                                              (
                        delegate(ATTGroupMember m)
                    {
                        return
                        (m.OrgID == objGroup.OrgID &&
                         m.GroupID == objGroup.GroupID);
                    }
                                              );

                    lstGroup.Add(objGroup);
                }

                if (ContainDefault == true && lstGroup.Count > 0)
                {
                    lstGroup.Insert(0, new ATTGroup(0, 0, "छान्नुहोस्", "", ""));
                }

                return(lstGroup);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
예제 #6
0
        public static bool AddGroup(ATTGroup obj)
        {
            string SP = "";

            if (obj.Action == "A")
            {
                SP = "sp_add_group";
            }
            else
            {
                SP = "sp_edit_group";
            }

            List <OracleParameter> paramArray = new List <OracleParameter>();

            paramArray.Add(Utilities.GetOraParam("p_org_id", obj.OrgID, OracleDbType.Int16, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam("p_group_id", obj.GroupID, OracleDbType.Int16, ParameterDirection.InputOutput));
            paramArray.Add(Utilities.GetOraParam("p_group_name", obj.GroupName, OracleDbType.Varchar2, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam("p_description", obj.Description, OracleDbType.Varchar2, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam("p_active", obj.Active, OracleDbType.Varchar2, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam("p_type", obj.Type, OracleDbType.Char, ParameterDirection.Input));

            GetConnection DBConn = new GetConnection();

            try
            {
                OracleConnection Conn = DBConn.GetDbConn(Module.OAS);
                SqlHelper.ExecuteNonQuery(Conn, CommandType.StoredProcedure, SP, paramArray.ToArray());
                obj.GroupID = int.Parse(paramArray[1].Value.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DBConn.CloseDbConn();
            }
        }
예제 #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.ddlOrg.SelectedIndex <= 0)
            {
                this.lblStatusMessage.Text = "Please select organization from list.";
                this.programmaticModalPopup.Show();
                return;
            }

            ATTGroup obj = new ATTGroup();

            obj.OrgID       = int.Parse(this.ddlOrg.SelectedValue);
            obj.GroupID     = 0;
            obj.GroupName   = this.txtCommittee.Text.Trim();
            obj.Description = this.txtDescription.Text.Trim();
            obj.Active      = (this.chkActive.Checked == true) ? "Y" : "N";
            obj.Type        = 'C';

            ObjectValidation result = BLLGroup.Validate(obj);
            if (result.IsValid == false)
            {
                this.lblStatusMessage.Text = result.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }

            if (this.lstCommittee.SelectedIndex < 0)
            {
                obj.Action = "A";
            }
            else
            {
                obj.GroupID = int.Parse(this.lstCommittee.SelectedValue);
                obj.Action  = "E";
            }

            BLLGroup.AddGroup(obj);
            if (obj.Action == "A")
            {
                ((List <ATTGroup>)Session["GroupLst"]).Add(obj);
            }
            else
            {
                ((List <ATTGroup>)Session["GroupLst"])[this.lstCommittee.SelectedIndex] = obj;
            }

            Session["Grouplst"]              = BLLGroup.GetGroupList(int.Parse(this.ddlOrg.SelectedValue), false, 'C');
            this.lstCommittee.DataSource     = Session["GroupLst"];
            this.lstCommittee.DataTextField  = "GroupName";
            this.lstCommittee.DataValueField = "GroupID";
            this.lstCommittee.DataBind();

            this.ClearME();

            this.lblStatusMessage.Text = "Committee successfully saved.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }