public static List <ATTPost> GetPost(int?PostId)
        {
            List <ATTPost> LstPost = new List <ATTPost>();

            try
            {
                foreach (DataRow row in DLLPost.GetPost(PostId).Rows)
                {
                    ATTPost ObjAtt = new ATTPost
                                     (
                        int.Parse(row["POST_ID"].ToString()),
                        row["POST_NAME"].ToString()
                                     );
                    List <ATTPostLevel> PostLevelList = BLLPostLevel.GetPostLevel(ObjAtt.PostID);

                    ObjAtt.LstPostLevel = PostLevelList.FindAll(delegate(ATTPostLevel att) { return(att.PostID == ObjAtt.PostID); });

                    LstPost.Add(ObjAtt);
                }
                return(LstPost);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static List <ATTPost> GetAllDesgPost(int?orgID, int?desID, string created_date)
        {
            List <ATTPost> LstOrgDesgPost = new List <ATTPost>();

            try
            {
                foreach (DataRow row in DLLPost.GetAllDesgPost(orgID, desID, created_date).Rows)
                {
                    ATTPost ObjAtt = new ATTPost
                                     (
                        int.Parse(row["ORG_ID"].ToString()),
                        int.Parse(row["DES_ID"].ToString()),
                        (row["CREATED_DATE"] == System.DBNull.Value ? "" : (string)row["CREATED_DATE"]),
                        int.Parse(row["POST_ID"].ToString()),
                        (row["POST_NAME"] == System.DBNull.Value ? "" : (string)row["POST_NAME"]),
                        (row["OCCUPIED"] == System.DBNull.Value ? "" : (string)row["OCCUPIED"]));
                    ObjAtt.DesName = (string)row["DES_NAME"];
                    LstOrgDesgPost.Add(ObjAtt);
                }
                return(LstOrgDesgPost);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    void ManageAvailablePost()
    {
        List <ATTPost> lstCurrentPost = Session["CurrentPostList"] as List <ATTPost>;

        foreach (GridViewRow row in this.grdPostList.Rows)
        {
            ATTPost obj = lstCurrentPost.Find
                          (
                delegate(ATTPost p)
            {
                return(p.OrgID == int.Parse(row.Cells[2].Text) &&
                       p.DesID == int.Parse(row.Cells[3].Text) &&
                       p.CreatedDate == row.Cells[14].Text &&
                       p.PostID == int.Parse(row.Cells[4].Text));
            }
                          );

            if (obj != null)
            {
                this.UsedPostList.Add(obj);
                this.CurrentPostList.Remove(obj);
                break;
            }
        }

        this.ddlAvailablePost_Rqd.Items.Clear();
        this.ddlAvailablePost_Rqd.Items.Add(new ListItem("--- छान्नुहोस ---", "0"));
        this.ddlAvailablePost_Rqd.DataSource     = lstCurrentPost;
        this.ddlAvailablePost_Rqd.DataTextField  = "RDPOSTNAMEWITHCREATIONDATE";//"RDPOSTNAMEWITHCREATIONDATE";
        this.ddlAvailablePost_Rqd.DataValueField = "RDPOSTIDWITHCREATIONDATE";
        this.ddlAvailablePost_Rqd.DataBind();
    }
 public static bool SavePosts(ATTPost ObjAtt)
 {
     try
     {
         return(true);//DLLOrganizationDesignation.SaveOrganizationDesignation(ObjAtt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static bool SavePost(ATTPost ObjAtt)
 {
     try
     {
         return(DLLPost.SavePost(ObjAtt));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static ObjectValidation Validate(ATTPost ObjAtt)
        {
            ObjectValidation OV = new ObjectValidation();

            if (ObjAtt.PostName == "")
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Post Name Cannot Be Blank.";
                return(OV);
            }
            return(OV);
        }
Пример #7
0
        public static bool SavePost(ATTPost ObjAtt)
        {
            GetConnection     Conn = new GetConnection();
            OracleConnection  DBConn;
            OracleTransaction Tran;
            string            InsertUpdatePostSql = "";

            try
            {
                DBConn = Conn.GetDbConn(Module.DLPDS);
                Tran   = DBConn.BeginTransaction();

                if (ObjAtt.PostID == 0)
                {
                    InsertUpdatePostSql = "SP_ADD_POST";
                }
                else
                {
                    InsertUpdatePostSql = "SP_EDIT_POST";
                }

                OracleParameter[] ParamArray = new OracleParameter[2];

                ParamArray[0] = Utilities.GetOraParam(":p_POST_ID", ObjAtt.PostID, OracleDbType.Int64, ParameterDirection.InputOutput);
                ParamArray[1] = Utilities.GetOraParam(":p_POST_NAME", ObjAtt.PostName, OracleDbType.Varchar2, ParameterDirection.Input);

                SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdatePostSql, ParamArray);


                int PostID = int.Parse(ParamArray[0].Value.ToString());

                ObjAtt.PostID = PostID;

                DLLPostLevel.SavePostLevel(ObjAtt.LstPostLevel, Tran, PostID);

                Tran.Commit();

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                Conn.CloseDbConn();
            }
        }
Пример #8
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        List <ATTPost> PostList = (List <ATTPost>)Session["Post"];

        int PostID;

        if (lstPost.SelectedIndex == -1)
        {
            PostID = 0;
        }
        else
        {
            PostID = int.Parse(lstPost.SelectedValue.ToString());
        }
        try
        {
            ATTPost ObjAtt = new ATTPost(PostID, txtPostName_Rqd.Text.Trim());

            foreach (GridViewRow row in grdPostLevel.Rows)
            {
                if (row.Cells[3].Text.Trim() != "&nbsp;")
                {
                    ATTPostLevel attPL = new ATTPostLevel(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text.Trim(), row.Cells[3].Text.Trim());
                    ObjAtt.LstPostLevel.Add(attPL);
                }
            }

            ObjectValidation OV = BLLPost.Validate(ObjAtt);

            if (OV.IsValid == false)
            {
                lblStatusMessage.Text = OV.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }


            for (int i = 0; i < lstPost.Items.Count; i++)
            {
                if (lstPost.SelectedIndex != i)
                {
                    if (PostList[i].PostName.ToLower() == txtPostName_Rqd.Text.Trim().ToLower())
                    {
                        this.lblStatusMessage.Text = "Post Name Already Exists";
                        this.programmaticModalPopup.Show();
                        return;
                    }
                }
            }

            BLLPost.SavePost(ObjAtt);

            if (lstPost.SelectedIndex > -1)
            {
                PostList[lstPost.SelectedIndex].PostID   = ObjAtt.PostID;
                PostList[lstPost.SelectedIndex].PostName = ObjAtt.PostName;
                PostList[lstPost.SelectedIndex].LstPostLevel.Clear();

                foreach (GridViewRow row in grdPostLevel.Rows)
                {
                    if (row.Cells[3].Text.Trim() != "D")
                    {
                        ATTPostLevel attPL = new ATTPostLevel(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text, "");
                        PostList[lstPost.SelectedIndex].LstPostLevel.Add(attPL);
                    }
                }
            }
            else
            {
                PostList.Add(ObjAtt);
            }

            lstPost.DataSource     = PostList;
            lstPost.DataTextField  = "PostName";
            lstPost.DataValueField = "PostID";
            lstPost.DataBind();

            ClearControls();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
            return;
        }
    }
    protected void btnCreatePost_Click(object sender, EventArgs e)
    {
        string msg   = "";
        int    count = 0;

        if (this.ddlOrganization_Rqd.SelectedIndex == 0)
        {
            msg += "<br/>**कार्यालय छान्नुहोस्<br/>";
            count++;
        }
        if (this.ddlDesignation_Rqd.SelectedIndex == 0)
        {
            msg += "**पद छान्नुहोस्<br/>";
            count++;
        }
        if (this.ddlDesignationLevel_Rqd.SelectedIndex == 0)
        {
            msg += "**श्रेणी छान्नुहोस्<br/>";
            count++;
        }
        if (this.txtTotalSeats_Rqd.Text == "")
        {
            msg += "**संख्या भर्नुहोस्";
            count++;
        }
        if (count > 0)
        {
            this.lblStatusMessage.Text = msg;
            this.programmaticModalPopup.Show();
            return;
        }
        try
        {
            if (this.grdOrgDesignation.SelectedIndex == -1)
            {
                List <ATTPost> NewDesPost = new List <ATTPost>();
                for (int i = 1; i <= int.Parse(this.txtTotalSeats_Rqd.Text); i++)
                {
                    ATTPost post = new ATTPost();
                    post.OrgID       = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString());
                    post.DesID       = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString());
                    post.PostID      = 0;
                    post.OrgName     = this.ddlOrganization_Rqd.SelectedItem.Text;
                    post.DesName     = this.ddlDesignation_Rqd.SelectedItem.Text;
                    post.PostName    = this.ddlDesignation_Rqd.SelectedItem.Text;
                    post.Occupied    = "NO";
                    post.CreatedDate = this.txtCreatedDate_DT.Text.Trim();
                    NewDesPost.Add(post);
                }
                this.grdDesPost.DataSource = NewDesPost;
                this.grdDesPost.DataBind();
            }

            else
            {
                List <ATTPost> PostList = (List <ATTPost>)Session["PostTbl"];
                if (int.Parse(this.txtTotalSeats_Rqd.Text.ToString()) < this.grdDesPost.Rows.Count)
                {
                    this.lblStatusMessage.Text = "Total Quantity Should Be Less Than (or) Equal To Previous Quantity.";
                    this.programmaticModalPopup.Show();
                    return;
                }
                for (int i = 1; i <= int.Parse(this.txtTotalSeats_Rqd.Text) - this.grdDesPost.Rows.Count; i++)
                {
                    ATTPost post = new ATTPost();
                    post.OrgID       = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString());
                    post.DesID       = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString());
                    post.OrgName     = this.ddlOrganization_Rqd.SelectedItem.Text;
                    post.DesName     = this.ddlDesignation_Rqd.SelectedItem.Text;
                    post.PostName    = this.ddlDesignation_Rqd.SelectedItem.Text;
                    post.Occupied    = "NO";
                    post.CreatedDate = this.txtCreatedDate_DT.Text.Trim();
                    PostList.Add(post);
                }
                this.grdDesPost.DataSource = PostList;
                this.grdDesPost.DataBind();
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
            return;
        }
    }
    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();
        }
    }