private void GetProjectBidding()
        {
            Mas_ProjectBidding_Manage bl       = new Mas_ProjectBidding_Manage();
            MAS_PROJECTBIDDING        projData = new MAS_PROJECTBIDDING();

            projData.ProjectNo = Int64.Parse(string.IsNullOrWhiteSpace(hdfProjectNo.Value.ToString()) ? "0" : hdfProjectNo.Value.ToString());
            //Convert.ToInt64((string)ViewState["ProjectNo"]);
            projData = bl.GetMasProjItemBidding(projData);

            /**************** Retrieve Data ********************/
            hdfProjectNo.Value = projData.ProjectNo.ToString();

            lblBiddingCode.Text = projData.BiddingCode;
            lblContactName.Text = projData.ContactName;
            lblEmail.Text       = projData.Email;
            lblEndDate.Text     = projData.EndDate.ToString(@"dd\/MM\/yyyy");
            lblPhoneNo.Text     = projData.PhoneNo;
            lblProjectName.Text = projData.ProjectName;
            lblStartDate.Text   = projData.StartDate.ToString(@"dd\/MM\/yyyy");

            ViewState["TemplateNo"] = projData.TemplateNo.ToString();

            hdfBiddingCode.Value = projData.BiddingCode;

            BindItemProject(projData.TemplateNo.ToString());
            /***************************************************/
        }
        private void GetProjectBidding()
        {
            try
            {
                Mas_ProjectBidding_Manage bl       = new Mas_ProjectBidding_Manage();
                MAS_PROJECTBIDDING        projData = new MAS_PROJECTBIDDING();
                projData.ProjectNo = Int64.Parse(hdfProjectNo.Value.ToString().Trim());
                projData           = bl.GetMasProjItemBidding(projData);

                /**************** Retrieve Data ********************/
                lblAddress.Text     = projData.CompanyAddress;
                lblBiddingCode.Text = projData.BiddingCode;
                lblContactName.Text = projData.ContactName;
                lblEmail.Text       = projData.Email;
                lblEndDate.Text     = projData.EndDate.ToString(@"dd\/MM\/yyyy");
                lblPhoneNo.Text     = projData.PhoneNo;
                lblProjectName.Text = projData.ProjectName;
                lblStartDate.Text   = projData.StartDate.ToString(@"dd\/MM\/yyyy");

                lblDepartment.Text = projData.DepartmentName.Trim();

                ViewState["PathFile"] = projData.AttachFilePath;
                SetDownloadAttachFile(projData.AttachFilePath);

                /**************** Check End Date *******************/
                int _totalDaysStart = (DateTime.Now - projData.StartDate).Days;
                if (_totalDaysStart < 0)
                {
                    btnAccept.Visible = false;
                    btnCancel.Visible = false;
                    btnBack.Visible   = true;
                }
                else
                {
                    int _totalDays = (projData.EndDate - DateTime.Now).Days;
                    if (_totalDays < 0)
                    {
                        btnAccept.Visible = false;
                        btnCancel.Visible = false;
                        btnBack.Visible   = true;
                    }
                }

                /***************************************************/
                BindItemProject(projData.TemplateNo.ToString());
                /***************************************************/
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
Beispiel #3
0
        private void ListBDProject()
        {
            List <MAS_PROJECTBIDDING_DTO> lItemRet = new List <MAS_PROJECTBIDDING_DTO>();
            MAS_PROJECTBIDDING            data     = new MAS_PROJECTBIDDING();
            Mas_ProjectBidding_Manage     manage   = new Mas_ProjectBidding_Manage();

            lItemRet = manage.ListAllProjBidingActive();

            ddlBDProject.DataSource = lItemRet;
            ddlBDProject.DataBind();

            ddlBDProject.Items.Insert(0, new ListItem("== เลือกรายการ ==", "0"));
        }
        private void BindGridview()
        {
            try
            {
                List <MAS_PROJECTBIDDING_DTO> lItemRet = new List <MAS_PROJECTBIDDING_DTO>();
                MAS_PROJECTBIDDING            data     = new MAS_PROJECTBIDDING();
                Mas_ProjectBidding_Manage     manage   = new Mas_ProjectBidding_Manage();

                string BiddingCode  = "";
                string ProjectName  = "";
                string BiddingMonth = "";
                string Department   = "";

                if (ddlSearch.SelectedIndex != 0)
                {
                    switch (ddlSearch.SelectedValue)
                    {
                    case "1":
                        BiddingCode = txtSearch.Text.Trim();
                        break;

                    case "2":
                        ProjectName = txtSearch.Text.Trim();
                        break;

                    case "3":
                        Department = txtSearch.Text.Trim();
                        break;
                    }
                }

                if (ddlSelMonth.SelectedIndex != 0)
                {
                    BiddingMonth = ddlSelMonth.SelectedValue;
                }

                lItemRet = manage.ListProjectDefault(BiddingCode, ProjectName, BiddingMonth, Department);

                gvListProject.DataSource = lItemRet;
                gvListProject.DataBind();

                Session["ProjectBiddingRPT"] = lItemRet;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
        private void GetProjectBidding()
        {
            Mas_ProjectBidding_Manage bl       = new Mas_ProjectBidding_Manage();
            MAS_PROJECTBIDDING        projData = new MAS_PROJECTBIDDING();

            projData.ProjectNo = Convert.ToInt64(string.IsNullOrWhiteSpace(hdfProjectNo.Value) ? "0" : hdfProjectNo.Value.ToString());
            projData           = bl.GetMasProjItemBidding(projData);

            /**************** Retrieve Data ********************/
            lblBiddingCode.Text = projData.BiddingCode;
            lblProjectName.Text = projData.ProjectName;
            lblStartDate.Text   = projData.StartDate.ToString(@"dd\/MM\/yyyy");
            lblEndDate.Text     = projData.EndDate.ToString(@"dd\/MM\/yyyy");

            //lblContactName.Text = projData.ContactName;
            //lblEmail.Text = projData.Email;
            //lblPhoneNo.Text = projData.PhoneNo;
            /***************************************************/
        }
Beispiel #6
0
        private void GetProjectBidding()
        {
            Mas_ProjectBidding_Manage bl       = new Mas_ProjectBidding_Manage();
            MAS_PROJECTBIDDING        projData = new MAS_PROJECTBIDDING();

            projData.ProjectNo = Int64.Parse(string.IsNullOrWhiteSpace(hdfProjectNo.Value.ToString()) ? "0" : hdfProjectNo.Value.ToString());
            projData           = bl.GetMasProjItemBidding(projData);

            /**************** Retrieve Data ********************/
            hdfProjectNo.Value  = projData.ProjectNo.ToString();
            lblBiddingCode.Text = projData.BiddingCode;
            lblProjectName.Text = projData.ProjectName;

            ViewState["TemplateNo"] = projData.TemplateNo.ToString();
            hdfBiddingCode.Value    = projData.BiddingCode;

            BindItemProject(projData.TemplateNo.ToString());
            /***************************************************/
        }
        private void BindGridview()
        {
            List <MAS_PROJECTBIDDING_DTO> lItemRet = new List <MAS_PROJECTBIDDING_DTO>();
            MAS_PROJECTBIDDING            data     = new MAS_PROJECTBIDDING();
            Mas_ProjectBidding_Manage     manage   = new Mas_ProjectBidding_Manage();

            string BiddingCode  = "";
            string ProjectName  = "";
            string BiddingMonth = "";

            string UserName = "";

            if (hdfRoleNo.Value.Trim().Equals("2"))
            {
                UserName = hdfUserName.Value.Trim();
            }

            if (ddlSearch.SelectedIndex != 0)
            {
                switch (ddlSearch.SelectedValue)
                {
                case "1":
                    BiddingCode = txtSearch.Text.Trim();
                    break;

                case "2":
                    ProjectName = txtSearch.Text.Trim();
                    break;
                }
            }

            if (ddlSelMonth.SelectedIndex != 0)
            {
                BiddingMonth = ddlSelMonth.SelectedValue;
            }

            lItemRet = manage.ListBiddingProject(BiddingCode, ProjectName, BiddingMonth, UserName);

            gvListProject.DataSource = lItemRet;
            gvListProject.DataBind();
        }
Beispiel #8
0
        public List <MAS_PROJECTBIDDING> ListALLProject(MAS_PROJECTBIDDING data)
        {
            IDbConnection             conn = null;
            List <MAS_PROJECTBIDDING> ret  = null;

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();
                ret = new List <MAS_PROJECTBIDDING>();

                Mas_ProjectBiddingBL bl = new Mas_ProjectBiddingBL(conn);
                ret = bl.ListAllData(data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
Beispiel #9
0
        public string InsertMasProjtBidding(MAS_PROJECTBIDDING data, List <MAS_PROJECTITEMBIDDING> lItemData)
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            IDbConnection  conn = null;
            IDbTransaction tran = null;

            string ret = string.Empty;

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();
                tran = conn.BeginTransaction(IsolationLevel.Serializable);

                Mas_ProjectBiddingBL     bidBL  = new Mas_ProjectBiddingBL(conn, tran);
                Mas_ProjectITemBiddingBL itemBl = new Mas_ProjectITemBiddingBL(conn, tran);

                string pkProjectBD = string.Empty;
                pkProjectBD = bidBL.InsertData(data);
                if (!string.IsNullOrWhiteSpace(pkProjectBD))
                {
                    ret = pkProjectBD;

                    foreach (MAS_PROJECTITEMBIDDING item in lItemData)
                    {
                        MAS_PROJECTITEMBIDDING insItem = new MAS_PROJECTITEMBIDDING();
                        insItem.ProjectNo   = pkProjectBD;
                        insItem.ItemColumn1 = item.ItemColumn1;
                        insItem.ItemColumn2 = item.ItemColumn2;
                        insItem.ItemColumn3 = item.ItemColumn3;
                        insItem.ItemColumn4 = item.ItemColumn4;
                        insItem.ItemColumn5 = item.ItemColumn5;
                        insItem.ItemColumn6 = item.ItemColumn6;
                        insItem.ItemColumn7 = item.ItemColumn7;
                        insItem.ItemColumn8 = item.ItemColumn8;

                        insItem.CreatedBy   = data.CreatedBy;
                        insItem.CreatedDate = DateTime.Now;
                        insItem.UpdatedBy   = data.UpdatedBy;
                        insItem.UpdatedDate = DateTime.Now;

                        itemBl.InsertData(insItem);
                    }
                }

                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();

                ret = string.Empty;

                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }

                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            logger.Info("btnSave_Click-[Start]");
            try
            {
                if (IsValid)
                {
                    /****************** Insert to tb MAS_PROJECTBIDDING ************************/
                    Mas_ProjectBidding_Manage manage  = new Mas_ProjectBidding_Manage();
                    MAS_PROJECTBIDDING        insData = new MAS_PROJECTBIDDING();
                    insData.ProjectName    = txtProjectName.Text.Trim();
                    insData.TemplateNo     = Int64.Parse(ddlItemTemplate.SelectedValue.ToString().Trim());
                    insData.CompanyAddress = txtContactAdd.Text;

                    //insData.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim());
                    //insData.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim());

                    string          format  = ConfigurationManager.GetConfiguration().DateFormat;
                    IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);

                    string _startDate = txtStartDate.Text.Trim();
                    insData.StartDate = DateTime.ParseExact(_startDate, format, culture);

                    string _endDate = txtEndDate.Text.Trim();
                    insData.EndDate = DateTime.ParseExact(_endDate, format, culture);

                    insData.ContactName = txtContactPers.Text.Trim();
                    insData.Email       = txtContactEmail.Text.Trim();
                    insData.PhoneNo     = txtContactPhone.Text.Trim();

                    insData.CreatedBy   = hdfUserName.Value.Trim();
                    insData.CreatedDate = DateTime.Now;
                    insData.UpdatedBy   = hdfUserName.Value.Trim();
                    insData.UpdatedDate = DateTime.Now;

                    //*********** AddBy Preecha J. 2018-10-08***********//
                    insData.DepartmentName = ddlDepartment.SelectedValue.Trim();
                    //**************************************************//

                    List <MAS_PROJECTITEMBIDDING> lItemProj = new List <MAS_PROJECTITEMBIDDING>();
                    lItemProj = (List <MAS_PROJECTITEMBIDDING>)ViewState["AddNewItem"];

                    logger.Info("InsertMasProjtBidding-[Start]");

                    string strBiddNo = manage.InsertMasProjtBidding(insData, lItemProj);

                    logger.Info("InsertMasProjtBidding-[End]");

                    if (!string.IsNullOrWhiteSpace(strBiddNo))
                    {
                        string strPathFile = ConfigurationManager.GetConfiguration().AttachFilePath;
                        string strPathDate = DateTime.Now.ToString("ddMMyyyy") + "/";
                        string bdCode      = GenBiddingCode(strBiddNo);

                        string pathUpload    = strPathFile + strPathDate + bdCode + "/";
                        String ServerMapPath = Server.MapPath(pathUpload);

                        /******************* Update BiddingCode ****************/
                        MAS_PROJECTBIDDING updData = new MAS_PROJECTBIDDING();
                        updData.ProjectNo      = Convert.ToInt64(strBiddNo);
                        updData.BiddingCode    = bdCode;
                        updData.AttachFilePath = pathUpload + fuTOR.FileName;
                        /*******************************************************/

                        /***************** Upload File  ************************/
                        if (manage.UpdateBiddingCode(updData))
                        {
                            if (!System.IO.Directory.Exists(Server.MapPath(pathUpload)))
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath(pathUpload));
                            }

                            fuTOR.PostedFile.SaveAs(ServerMapPath + fuTOR.FileName);

                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert",
                            // "alert('สร้างรายการเรียบร้อย..');window.location ='Default.aspx';", true);

                            lblMsgResult.Text       = "สร้างรายการ จัดซื้อ/จัดจ้าง สำเร็จ";
                            Session["CreateResult"] = "y";
                        }
                        else
                        {
                            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                            //    "alertMessage", "alert('ไม่สามารถบันทึกข้อมูลได้! กรุณาติดต่อผู้ดูแลระบบ')", true);
                            lblMsgResult.Text       = "ไม่สามารถสร้างรายการได้! กรุณาติดต่อผู้ดูแลระบบ";
                            Session["CreateResult"] = "n";
                        }
                    }
                    /***************************************************************/

                    lbtnPopup_ModalPopupExtender.Show();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);

                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ไม่สามารถบันทึกข้อมูลได้! กรุณาติดต่อผู้ดูแลระบบ')", true);
                lblMsgResult.Text       = "ไม่สามารถบันทึกข้อมูลได้! กรุณาติดต่อผู้ดูแลระบบ";
                Session["CreateResult"] = "n";

                lbtnPopup_ModalPopupExtender.Show();
            }

            logger.Info("btnSave_Click-[End]");
        }
Beispiel #11
0
        private void BindGridview()
        {
            try
            {
                List <MAS_PROJECTBIDDING_DTO> lItemRet = new List <MAS_PROJECTBIDDING_DTO>();
                MAS_PROJECTBIDDING            data     = new MAS_PROJECTBIDDING();
                Mas_ProjectBidding_Manage     manage   = new Mas_ProjectBidding_Manage();

                string BiddingCode  = "";
                string ProjectName  = "";
                string BiddingMonth = "";
                string CompanyName  = "";

                string Username = "";
                if (hdfRoleNo.Value.Trim().Equals("2"))
                {
                    Username = hdfUserName.Value.Trim();
                }

                if (ddlSearch.SelectedIndex != 0)
                {
                    switch (ddlSearch.SelectedValue)
                    {
                    case "1":
                        BiddingCode = txtSearch.Text.Trim();
                        break;

                    case "2":
                        ProjectName = txtSearch.Text.Trim();
                        break;

                    case "3":
                        CompanyName = txtSearch.Text.Trim();
                        break;
                    }
                }

                if (ddlSelMonth.SelectedIndex != 0)
                {
                    BiddingMonth = ddlSelMonth.SelectedValue;
                }

                lItemRet = manage.ListBiddingProjectHistory(BiddingCode, ProjectName, BiddingMonth, Username, CompanyName);

                /********************** For Sort Gridview ************************/
                string _sortBy = (string)ViewState["SortGridview_BidingHistory"];
                switch (_sortBy.Trim())
                {
                case "BiddingsNo DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.BiddingsNo).ToList();
                    break;

                case "BiddingCode":
                    lItemRet = lItemRet.OrderBy(x => x.BiddingCode).ToList();
                    break;

                case "BiddingCode DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.BiddingCode).ToList();
                    break;

                case "ProjectName":
                    lItemRet = lItemRet.OrderBy(x => x.ProjectName).ToList();
                    break;

                case "ProjectName DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.ProjectName).ToList();
                    break;

                case "EndDate":
                    lItemRet = lItemRet.OrderBy(x => x.EndDate).ToList();
                    break;

                case "EndDate DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.EndDate).ToList();
                    break;

                case "BiddingPrice":
                    lItemRet = lItemRet.OrderBy(x => x.BiddingPrice).ToList();
                    break;

                case "BiddingPrice DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.BiddingPrice).ToList();
                    break;

                case "CompanyName":
                    lItemRet = lItemRet.OrderBy(x => x.CompanyName).ToList();
                    break;

                case "CompanyName DESC":
                    lItemRet = lItemRet.OrderByDescending(x => x.CompanyName).ToList();
                    break;
                }
                /*****************************************************************/

                gvListProject.DataSource = lItemRet;
                gvListProject.DataBind();

                Session["BidingProjectHistoryRPT"] = lItemRet;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }