void LoadOrganizationAvailablePosts(int OrgID)
    {
        this.ddlPost.DataSource = "";
        this.ddlPost.Items.Clear();

        try
        {
            string desType = "";
            if (Session["ApplicationID"].ToString() == "2")
            {
                desType = "J";
            }
            else if (Session["ApplicationID"].ToString() == "3")
            {
                desType = "O";
            }
            List <ATTOrganizationDesignation> lst = BLLOrganizationDesignation.GetOrganizationDesignation(OrgID, null, desType);
            if (lst.Count > 0)
            {
                ATTOrganizationDesignation obj = new ATTOrganizationDesignation();
                obj.DesName = "--- Select Designation ---";
                lst.Insert(0, obj);
            }
            this.ddlPost.DataSource     = lst;
            this.ddlPost.DataTextField  = "DesName";
            this.ddlPost.DataValueField = "DesID";
            this.ddlPost.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    public void LoadOrganizationAvailablePosts()
    {
        this.ddlPost.DataSource = "";
        this.ddlPost.Items.Clear();

        try
        {
            string desType = "J";

            Session["PmsRptPostList"] = BLLOrganizationDesignation.GetOrganizationDesignation(null, null, desType);
            List <ATTOrganizationDesignation> lst = (List <ATTOrganizationDesignation>)Session["PmsRptPostList"];
            if (lst.Count > 0)
            {
                ATTOrganizationDesignation obj = new ATTOrganizationDesignation();
                obj.DesName = "पद छान्नुहोस्";
                lst.Insert(0, obj);
            }
            this.ddlPost.DataSource     = lst;
            this.ddlPost.DataTextField  = "DesName";
            this.ddlPost.DataValueField = "DesID";
            this.ddlPost.DataBind();
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
Ejemplo n.º 3
0
 public static bool SaveOrganizationDesignation(ATTOrganizationDesignation ObjAtt)
 {
     try
     {
         return(DLLOrganizationDesignation.SaveOrganizationDesignation(ObjAtt));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
        public static ObjectValidation Validate(ATTOrganizationDesignation ObjAtt)
        {
            ObjectValidation OV = new ObjectValidation();

            if (ObjAtt.OrgID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select The Organization.";
                return(OV);
            }

            if (ObjAtt.DesID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select The Designation.";
                return(OV);
            }
            if (ObjAtt.TotalSeats == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Total Seats Cannot Be Empty.";
                return(OV);
            }

            if (ObjAtt.SewaID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select Sewa.";
                return(OV);
            }

            if (ObjAtt.SamuhaID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select Samuha.";
                return(OV);
            }
            if (ObjAtt.UpaSamuhaID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select UpaSamuma.";
                return(OV);
            }

            if (ObjAtt.DesgLevelID == 0)
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Select Shreni.";
                return(OV);
            }

            return(OV);
        }
Ejemplo n.º 5
0
        public static bool SaveOrganizationDesignation(ATTOrganizationDesignation ObjAtt)
        {
            GetConnection     Conn   = new GetConnection();
            OracleConnection  DBConn = Conn.GetDbConn(Module.PMS);
            OracleTransaction Tran   = DBConn.BeginTransaction();

            string InsertUpdateSql = "";

            if (ObjAtt.Action == "A")
            {
                InsertUpdateSql = "SP_ADD_ORG_DESIGNATIONS";
            }
            else if (ObjAtt.Action == "E")
            {
                InsertUpdateSql = "SP_EDIT_ORG_DESIGNATIONS";
            }

            try
            {
                OracleParameter[] ParamArray = new OracleParameter[11];
                ParamArray[0]      = Utilities.GetOraParam(":p_ORG_ID", ObjAtt.OrgID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[1]      = Utilities.GetOraParam(":p_DES_ID", ObjAtt.DesID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[2]      = Utilities.GetOraParam(":p_CREATED_DATE", ObjAtt.CreatedDate, OracleDbType.Varchar2, ParameterDirection.InputOutput);
                ParamArray[3]      = Utilities.GetOraParam(":p_PARENT_ORG", ObjAtt.ParentOrg, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[4]      = Utilities.GetOraParam(":p_PARENT_DES", ObjAtt.ParentDes, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[5]      = Utilities.GetOraParam(":p_TOT_SEATS", ObjAtt.TotalSeats, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[6]      = Utilities.GetOraParam(":p_SEWA_ID", ObjAtt.SewaID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[7]      = Utilities.GetOraParam(":p_SAMUHA_ID", ObjAtt.SamuhaID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[8]      = Utilities.GetOraParam(":p_UPASAMUHA_ID", ObjAtt.UpaSamuhaID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[9]      = Utilities.GetOraParam(":p_DESG_LEVEL_ID", ObjAtt.DesgLevelID, OracleDbType.Int64, ParameterDirection.Input);
                ParamArray[10]     = Utilities.GetOraParam(":p_ENTRY_BY", ObjAtt.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input);
                ParamArray[2].Size = 25;
                SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdateSql, ParamArray);
                ObjAtt.CreatedDate = ParamArray[2].Value.ToString();
                DLLPost.SavePosts(ObjAtt.LstPosts, ObjAtt.CreatedDate, Tran);
                Tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Conn.CloseDbConn();
            }
        }
Ejemplo n.º 6
0
        public static List <ATTOrganizationDesignation> GetOrganizationDesignation(int?orgID, int?desID, string desType)
        {
            List <ATTOrganizationDesignation> LstOrganizationDesignation = new List <ATTOrganizationDesignation>();

            try
            {
                foreach (DataRow row in DLLOrganizationDesignation.GetOrganizationDesignation(orgID, desID, desType).Rows)
                {
                    ATTOrganizationDesignation ObjAtt = new ATTOrganizationDesignation
                                                        (
                        int.Parse(row["ORG_ID"].ToString()),
                        int.Parse(row["DES_ID"].ToString()),
                        int.Parse(row["TOT_SEATS"].ToString()),
                        int.Parse(row["SEWA_ID"].ToString()),
                        int.Parse(row["SAMUHA_ID"].ToString()),
                        int.Parse(row["UPASAMUHA_ID"].ToString()),
                        int.Parse(row["DESG_LEVEL_ID"].ToString()));

                    ObjAtt.CreatedDate   = (string)row["CREATED_DATE"];
                    ObjAtt.SewaName      = (string)row["SEWA_NAME"];
                    ObjAtt.SamuhaName    = (string)row["SAMUHA_NAME"];
                    ObjAtt.UpaSamuhaName = (string)row["UPA_SAMUHA_NAME"];
                    ObjAtt.DesgLevelName = (string)row["LEVEL_NAME"];
                    ObjAtt.OrgName       = (string)row["ORG_NAME"];
                    ObjAtt.DesName       = (string)row["DES_NAME"];
                    ObjAtt.DesType       = (string)row["DES_TYPE"];
                    if (row["PARENT_ORG"] != System.DBNull.Value)
                    {
                        ObjAtt.ParentOrg = int.Parse(row["PARENT_ORG"].ToString());
                    }
                    if (row["PARENT_DES"] != System.DBNull.Value)
                    {
                        ObjAtt.ParentDes = int.Parse(row["PARENT_DES"].ToString());
                    }
                    LstOrganizationDesignation.Add(ObjAtt);
                }
                return(LstOrganizationDesignation);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        List <ATTOrganizationDesignation> OrgDesignationList = (List <ATTOrganizationDesignation>)Session["OrganizationDesignation"];
        ATTOrganizationDesignation        objOrgDesignation  = new ATTOrganizationDesignation();
        ATTPost objPost           = new ATTPost();
        int     intDesignationID  = 0;
        int     intOrganizationID = 0;
        int     intTotalSeats     = 0;
        int     intSewaID         = 0;
        int     intSamuhaID       = 0;
        int     intUpaSamuhaID    = 0;
        int     intDesgLevelID    = 0;
        string  strUser           = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;

        if (this.ddlDesignation_Rqd.SelectedIndex > 0)
        {
            intDesignationID = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString());
        }
        if (this.ddlOrganization_Rqd.SelectedIndex > 0)
        {
            intOrganizationID = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString());
        }
        if (this.ddlSewa_Rqd.SelectedIndex > 0)
        {
            intSewaID = int.Parse(this.ddlSewa_Rqd.SelectedValue.ToString());
        }
        if (this.ddlSamuha_Rqd.SelectedIndex > 0)
        {
            intSamuhaID = int.Parse(this.ddlSamuha_Rqd.SelectedValue.ToString());
        }
        if (this.ddlUpaSamuha_Rqd.SelectedIndex > 0)
        {
            intUpaSamuhaID = int.Parse(this.ddlUpaSamuha_Rqd.SelectedValue.ToString());
        }
        if (this.ddlDesignationLevel_Rqd.SelectedIndex > 0)
        {
            intDesgLevelID = int.Parse(this.ddlDesignationLevel_Rqd.SelectedValue.ToString());
        }

        foreach (GridViewRow row in this.grdDesPost.Rows)
        {
            CheckBox chkDelete = (CheckBox)(row.Cells[8].FindControl("chkPostSelect"));
            if (!chkDelete.Checked)
            {
                intTotalSeats += 1;
            }
        }

        if (this.grdDesPost.Rows.Count == 0)
        {
            this.lblStatusMessage.Text = "Enter The Total Quantity And Click Create Post (or) Update Post.";
            this.programmaticModalPopup.Show();
            return;
        }
        try
        {
            objOrgDesignation = new ATTOrganizationDesignation(intOrganizationID, intDesignationID, intTotalSeats, intSewaID, intSamuhaID, intUpaSamuhaID, intDesgLevelID);
            ObjectValidation OV = BLLOrganizationDesignation.Validate(objOrgDesignation);
            if (!OV.IsValid)
            {
                this.lblStatusMessage.Text = OV.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }
            if (this.txtCreatedDate_DT.Text.Trim() != "")
            {
                objOrgDesignation.CreatedDate = this.txtCreatedDate_DT.Text.Trim(); //"2066.10.09";
            }
            objOrgDesignation.EntryBy = strUser;
            if (this.grdOrgDesignation.SelectedIndex == -1)
            {
                objOrgDesignation.Action = "A";
            }
            else
            {
                objOrgDesignation.Action = "E";
            }


            foreach (GridViewRow row in this.grdDesPost.Rows)
            {
                string strPostName    = "";
                string strOldPostName = "";

                CheckBox cb                = (CheckBox)(row.Cells[8].FindControl("chkPostSelect"));
                TextBox  txtboxPostName    = (TextBox)(row.Cells[5].FindControl("txtPostName"));
                TextBox  txtboxOldPostName = (TextBox)(row.Cells[6].FindControl("txtOldPostName"));
                strPostName     = txtboxPostName.Text.Trim();
                strOldPostName  = txtboxOldPostName.Text.Trim();
                objPost         = new ATTPost(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[8].Text.ToString(), int.Parse(row.Cells[2].Text.ToString()), strPostName, row.Cells[7].Text.ToString().Trim());
                objPost.EntryBy = strUser;
                objPost.Action  = "";
                if (row.Cells[2].Text.ToString().Trim() == "0" && !cb.Checked)
                {
                    objPost.Action = "A";
                }
                if (row.Cells[2].Text.ToString().Trim() != "0")
                {
                    if (cb.Checked)
                    {
                        objPost.Action = "D";
                    }
                    else if ((strPostName != strOldPostName) && !cb.Checked)
                    {
                        objPost.Action = "E";
                    }
                }

                if (objPost.Action != "")
                {
                    ObjectValidation OValidate = BLLPost.Validate(objPost);
                    if (!OValidate.IsValid)
                    {
                        this.lblStatusMessage.Text = OValidate.ErrorMessage;
                        this.programmaticModalPopup.Show();
                        return;
                    }
                    objOrgDesignation.LstPosts.Add(objPost);
                }
            }


            //if (this.ddlParentOrganization.SelectedIndex > 0)
            //    objOrgDesignation.ParentOrg = int.Parse(this.ddlParentOrganization.SelectedValue.ToString());
            //if (this.ddlParentDesignation.SelectedIndex > 0)
            //    objOrgDesignation.ParentDes = int.Parse(this.ddlParentDesignation.SelectedValue.ToString());
            objOrgDesignation.OrgName       = this.ddlOrganization_Rqd.SelectedItem.Text;
            objOrgDesignation.DesName       = this.ddlDesignation_Rqd.SelectedItem.Text;
            objOrgDesignation.SewaName      = this.ddlSewa_Rqd.SelectedItem.Text;
            objOrgDesignation.SamuhaName    = this.ddlSamuha_Rqd.SelectedItem.Text;
            objOrgDesignation.UpaSamuhaName = this.ddlUpaSamuha_Rqd.SelectedItem.Text;
            objOrgDesignation.DesgLevelName = this.ddlDesignationLevel_Rqd.SelectedItem.Text;

            if (BLLOrganizationDesignation.SaveOrganizationDesignation(objOrgDesignation))
            {
                if (this.grdOrgDesignation.SelectedIndex > -1)
                {
                    OrgDesignationList[this.grdOrgDesignation.SelectedIndex].OrgID      = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString());
                    OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesID      = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString());
                    OrgDesignationList[this.grdOrgDesignation.SelectedIndex].OrgName    = this.ddlOrganization_Rqd.SelectedItem.Text.ToString();
                    OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesName    = this.ddlDesignation_Rqd.SelectedItem.Text.ToString();
                    OrgDesignationList[this.grdOrgDesignation.SelectedIndex].TotalSeats = objOrgDesignation.TotalSeats;
                }
                else
                {
                    OrgDesignationList.Add(objOrgDesignation);
                }
                this.grdOrgDesignation.DataSource = OrgDesignationList;
                this.grdOrgDesignation.DataBind();
                this.lblStatusMessage.Text = "**Post Created Successfully";
                this.programmaticModalPopup.Show();
                ClearControls();
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }