Ejemplo n.º 1
0
        private void btnConfirmProject_Click(object sender, EventArgs e)
        {
            if (!InputValidation())
            {
                return;
            }
            ProjectEntity projectEntity = new ProjectEntity();

            projectEntity.ProjectCode  = txtProjectCode.Text;
            projectEntity.ProjectName  = txtProjectName.Text;
            projectEntity.ScopeMM      = Int32.Parse(txtScopeMM.Text);
            projectEntity.Status       = (ProjectStatusValue)cbxProjectStatus.SelectedItem;
            projectEntity.StartedDate  = dtmStartedDate.Value;
            projectEntity.EndDate      = dtmEndDate.Value;
            projectEntity.CustomerName = txtCustomerName.Text;

            if (detailedFormMode == DetailedFormMode.Add)
            {
                projectBLL.AddProject(projectEntity);
            }
            if (detailedFormMode == DetailedFormMode.Update)
            {
                projectBLL.EditProject(projectEntity, projectID);
            }

            if (CommonFunctions.ShowQuestionDialog("Do you want continue to work with this project?", "Question") == DialogResult.OK)
            {
                detailedFormMode = DetailedFormMode.Update;
                load();
            }
            else
            {
                this.Close();
            }
        }
Ejemplo n.º 2
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            MembershipUser CurrentUser = Membership.GetUser();
            Guid           userId      = (Guid)CurrentUser.ProviderUserKey;

            int added = ProjectBLL.AddProject(userId, txt_ProjectName.Text, txt_Description.Text, txt_StartDate.Text, txt_EndDate.Text);

            if (added > 0)
            {
                lbl_success.Text = "Your data has been added successfully ✔";
            }
            else
            {
                lbl_success.Text = "Error! Please check your data and try again";
            }
        }
Ejemplo n.º 3
0
        private void btnCreateProject_Click(object sender, EventArgs e)
        {
            // Eğer text alanı boş gelirse ekleme işlemi yapılmayacak.
            if (String.IsNullOrEmpty(txtBoxProjectName.Text))
            {
                MessageBox.Show("Please enter a project name!", "Error..", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ProjectBLL projectBLL = new ProjectBLL();
                projectBLL.AddProject(txtBoxProjectName.Text);

                doRefresh = true;
                this.Close();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Used to save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                ProjectBO objProject = new ProjectBO();
                objProject.PercentageofPAP = Convert.ToDecimal(txtpercentage.Text.Trim());
                objProject.ProjectCode     = txtProjectCode.Text.Trim();
                objProject.ProjectName     = txtProjectName.Text.Trim();

                string sObj = txtObjective.Text.Trim();
                if (sObj.Trim().Length > 1000)
                {
                    sObj = sObj.Substring(0, 1000);
                }
                objProject.Objective = sObj.Trim();

                if (dpProjectStartDate.Text.Trim() != "")
                {
                    objProject.ProjectStartDate = Convert.ToDateTime(dpProjectStartDate.Text.ToString());
                }

                if (dpProjectEndDate.Text.Trim() != "")
                {
                    objProject.ProjectEndDate = Convert.ToDateTime(dpProjectEndDate.Text.ToString());
                }

                objProject.BudgetCurrency = Convert.ToInt32(ddlCurrencyTypeTotalEstBudget.SelectedValue);

                if (txtTotalEstBudget.Text.Trim().Length > 0)
                {
                    objProject.TotalEstBudget = Convert.ToDecimal(txtTotalEstBudget.Text.Trim());
                }
                if (txtLabouCost.Text.Trim().Length > 0)
                {
                    objProject.Labourcost = Convert.ToDecimal(txtLabouCost.Text);
                }
                if (txtBulMatCost.Text.Trim().Length > 0)
                {
                    objProject.BUILDINGMATCOST = Convert.ToDecimal(txtBulMatCost.Text);
                }
                if (txtDollervalue.Text.Trim().Length > 0)
                {
                    objProject.Dollervalue = Convert.ToDecimal(txtDollervalue.Text);
                }
                if (ddlProjectStatus.SelectedIndex > 0)
                {
                    objProject.ProjectStatus = ddlProjectStatus.SelectedItem.Value;
                }
                else
                {
                    ddlProjectStatus.ClearSelection();
                    ddlProjectStatus.SelectedIndex = 1;
                    objProject.ProjectStatus       = ddlProjectStatus.SelectedItem.Value;
                }

                if (Session["PROJECT_ID"] != null)
                {
                    objProject.ProjectID = Convert.ToInt32(Session["PROJECT_ID"]);
                    objProject.UpdatedBy = (int)Session["USER_ID"];
                }
                else
                {
                    objProject.CreatedBy = (int)Session["USER_ID"];
                }

                ProjectBLL objProjectBLL = new ProjectBLL();

                if (Session["PROJECT_ID"] != null)
                {
                    string msg = objProjectBLL.UpdateProject(objProject);
                    if (msg == "")
                    {
                        msg = "Data updated successfully.";
                    }
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + msg + "');", true);
                    ViewState["BudgetCurrency"] = ddlCurrencyTypeTotalEstBudget.SelectedValue;

                    if (txtTotalEstBudget.Text.Trim().Length > 0)
                    {
                        txtTotalEstBudget.Text = UtilBO.CurrencyFormat(Convert.ToDecimal(txtTotalEstBudget.Text));
                    }

                    DisplayEstBudget();
                }
                else
                {
                    string[] result  = objProjectBLL.AddProject(objProject);
                    string   message = "";

                    if (string.IsNullOrEmpty(result[1]) || result[1] == "" || result[1] == "null")
                    {
                        Session["PROJECT_ID"]   = result[0];
                        Session["PROJECT_CODE"] = objProject.ProjectCode;
                        Session["FROZEN"]       = "N";

                        message = "alert('Data saved successfully');location.href='ProjectRoute.aspx';";
                    }
                    else
                    {
                        message = result[1];
                        message = "alert('" + message + "');";
                    }

                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", message, true);
                }
            }
        }