Example #1
0
        public ServiceProject getServiceProjectByOrgIDDate(int orgID, string date)
        {
            ServiceProject serviceProject = new ServiceProject();

            try
            {
                var even = dataContext.sp_GetServiceProjectByOrgIDDate(orgID, date).First();
                serviceProject.ServiceProject_ID = even.ServiceProject_ID;
                serviceProject.CommunityPartner  = even.CommunityPartner;
                serviceProject.Title             = even.Title;
                serviceProject.ContactName       = even.ContactName;
                serviceProject.ContactEmail      = even.ContactEmail;
                serviceProject.ContactPhone      = even.ContactPhone;
                serviceProject.NoOfVolunteers    = even.NoOfVolunteers;
                serviceProject.OnGoing           = even.OnGoing;
                serviceProject.HoursVolunteered  = even.HoursVolunteered;
                serviceProject.Location          = even.Location;
                serviceProject.Organization_ID   = even.Organization_ID;
                serviceProject.Description       = even.Description;
                serviceProject.StartDate         = even.StartDate;
                serviceProject.EndDate           = even.EndDate;
                serviceProject.TimeFrom          = even.TimeFrom;
                serviceProject.TimeTo            = even.TimeTo;
                serviceProject.MeetDay           = even.MeetDay;
                serviceProject.Funds             = even.Funds;
                serviceProject.MeetFrequency     = even.MeetFrequency;
            }
            catch (Exception e)
            {
            }

            return(serviceProject);
        }
Example #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            TBL_MP_PMC_ProjectMaster model          = null;
            ServiceProject           serviceProject = new ServiceProject();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }
                if (this.ProjectID == 0)
                {
                    model = new TBL_MP_PMC_ProjectMaster();
                }
                else
                {
                    model = serviceProject.GetProjectDBInfoByID(this.ProjectID);
                }

                #region GATHER DATA INTO MODEL FROM VIEW
                model.ProjectNumber          = txtProjectNo.Text;
                model.ProjectName            = txtProjectName.Text.Trim();
                model.ProjectDate            = dtProjectDate.Value;
                model.StartDate              = dtProjectStartDate.Value;
                model.EndDate                = dtProjectEndDate.Value;
                model.FK_ProjectStatusID     = ((SelectListItem)cboProjectStatus.SelectedItem).ID;
                model.BillingClientID        = selectedBillingClientID;
                model.BillingClientAddressID = selectedBillingAddressID;
                model.SiteClientID           = selectedSiteClientID;
                model.SiteClientAddressID    = selectedSiteAddressID;
                #endregion

                if (this.ProjectID == 0)
                {
                    model.FK_CompanyID    = Program.CURR_USER.CompanyID;
                    model.FK_YearID       = Program.CURR_USER.FinYearID;
                    model.FK_BranchID     = Program.CURR_USER.BranchID;
                    model.CreatedBy       = Program.CURR_USER.EmployeeID;
                    model.CreatedDatetime = AppCommon.GetServerDateTime();
                    this.ProjectID        = serviceProject.AddNewProject(model);
                }
                else
                {
                    model.ModifiedBy       = Program.CURR_USER.EmployeeID;
                    model.ModifiedDatetime = AppCommon.GetServerDateTime();
                    serviceProject.UpdateProject(model);
                }
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditProject::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public ServiceProject getCurrentServiceProject()
        {
            ServiceProject project = new ServiceProject();

            try
            {
                int idservice = Convert.ToInt32(lblServiceProjectID.Text);

                project = ServiceProjectDAO.getServiceProjectByID(idservice);
            }
            catch (Exception)
            {
            }
            return(project);
        }
        public static void Main(string[] args)
        {
            IServiceSkill     servskill    = new ServiceSkill();
            IServiceResources servresource = new ServiceResources();
            IProjectService   servproj     = new ServiceProject();
            IServiceProfile   servprofil   = new ServiceProfil();
            IServiceMandate   servman      = new ServiceMandate();
            List <Profil>     lsprofil     = new List <Profil>();
            List <Resource>   lsresource   = new List <Resource>();
            List <Skills>     lsskills     = new List <Skills>();
            Project           p            = servproj.Get(a => a.projectId == 1);
            IServiceUser      servuser     = new ServiceUser();

            lsprofil   = servprofil.GetAll().Where(e => e.projectId == p.projectId).ToList();
            lsresource = servresource.GetAll().ToList();
            lsskills   = servskill.GetAll().ToList();
            DateTime today = DateTime.Now;

            foreach (var item in servman.GetAll())
            {
                System.DateTime dTime     = new System.DateTime(today.Year, today.Month, today.Day);
                System.TimeSpan tSpan     = new System.TimeSpan(3, 0, 0, 0);
                DateTime        finprojet = dTime + tSpan;
                //if (item.endDate.Equals(finprojet))
                //{

                //send mail
                MailMessage message = new MailMessage();



                message.To.Add("*****@*****.**");
                message.From    = new MailAddress("*****@*****.**");
                message.Subject = "Alerte Fin Mandat";
                message.Body    = "Bonjour, Plus que 40 jours avant la fin de ce mandat!==>" + item.project.description;


                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                client.EnableSsl   = true;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "somethinglikethis");
                client.Send(message);
            }
        }
        private void btnImportMasterPlan_Click(object sender, EventArgs e)
        {
            ServiceProject _service = new ServiceProject();

            try
            {
                switch (this.SelectedPlanType)
                {
                case PROJECT_PLAN_TYPE.PROJECT_PLANNING:
                    tabPageTaskNotes.Visible = false;
                    frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.ALL_PROJECTS);
                    frm.SingleSelect = true;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        int prevProjectID = frm.SelectedItems[0].ID;
                        _mManager = (new ServiceProject()).GetProjectPlanForProjectID(prevProjectID, PROJECT_PLAN_TYPE.PROJECT_PLANNING);
                        _mChart.Init(_mManager);
                        _mChart.Invalidate();
                    }
                    break;

                case PROJECT_PLAN_TYPE.PROJECT_EXECUTION:
                    string strMessage = "Are you sure to Generate Execution plan from MasterPlanning?";
                    if (MessageBox.Show(strMessage, "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _mManager = _service.GetProjectPlanForProjectID(this.SelectedProjectID, PROJECT_PLAN_TYPE.PROJECT_PLANNING);
                        _service.UpdateProjectPlanning(this.SelectedProjectID, _mManager, this.SelectedPlanType);
                        PopulateGanttChart();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlGanttChart::btnImportMasterPlan_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        public ServiceProject getServiceProjectByID(int idservice)
        {
            ServiceProject service = new ServiceProject();

            try
            {
                var svc = dataContext.sp_GetServiceProject(idservice).First();

                service.Organization_ID          = svc.Organization_ID;
                service.ServiceProject_ID        = svc.ServiceProject_ID;
                service.OnGoing                  = svc.OnGoing;
                service.Planned_HoursVolunteered = svc.Planned_HoursVolunteered;
                service.Planned_NoOfVolunteers   = svc.Planned_NoOfVolunteers;

                if (svc.Title == null)
                {
                    service.Title = "";
                }
                else
                {
                    service.Title = svc.Title;
                }

                if (svc.Location == null)
                {
                    service.Location = "";
                }
                else
                {
                    service.Location = svc.Location;
                }

                if (svc.CommunityPartner == null)
                {
                    service.CommunityPartner = "";
                }
                else
                {
                    service.CommunityPartner = svc.CommunityPartner;
                }

                if (svc.ContactEmail == null)
                {
                    service.ContactEmail = "";
                }
                else
                {
                    service.ContactEmail = svc.ContactEmail;
                }

                if (svc.ContactName == null)
                {
                    service.ContactName = "";
                }
                else
                {
                    service.ContactName = svc.ContactName;
                }

                if (svc.ContactPhone == null)
                {
                    service.ContactPhone = "";
                }
                else
                {
                    service.ContactPhone = svc.ContactPhone;
                }

                if (svc.Description == null)
                {
                    service.Description = "";
                }
                else
                {
                    service.Description = svc.Description;
                }

                if (svc.Funds == null)
                {
                    service.Funds = "";
                }
                else
                {
                    service.Funds = svc.Funds;
                }

                if (svc.Planned_Funds == null)
                {
                    service.Planned_Funds = "";
                }
                else
                {
                    service.Planned_Funds = svc.Planned_Funds;
                }

                if (svc.TimeFrom == null)
                {
                    service.TimeFrom = "";
                }
                else
                {
                    service.TimeFrom = svc.TimeFrom;
                }

                if (svc.TimeTo == null)
                {
                    service.TimeTo = "";
                }
                else
                {
                    service.TimeTo = svc.TimeTo;
                }

                service.EndDate          = svc.EndDate;
                service.StartDate        = svc.StartDate;
                service.HoursVolunteered = svc.HoursVolunteered;
                service.MeetDay          = svc.MeetDay;
                service.MeetFrequency    = svc.MeetFrequency;
                service.NoOfVolunteers   = svc.NoOfVolunteers;
            }
            catch (Exception e)
            {
            }

            return(service);
        }
Example #7
0
        public void PopulateProjectGeneralInfo()
        {
            this.Cursor = Cursors.WaitCursor;
            Application.UseWaitCursor = true;
            ServiceProject _service = new ServiceProject();

            try
            {
                SelectListItem           selItem = null;
                List <SelectListItem>    lst     = _service.GetAllProjectStatuses();
                TBL_MP_PMC_ProjectMaster model   = (new ServiceProject()).GetProjectDBInfoByID(this.SelectedProjectID);

                if (model != null)
                {
                    headerGroupMain.ValuesPrimary.Heading = model.ProjectNumber;
                    selItem        = lst.Where(x => x.ID == model.FK_ProjectStatusID).FirstOrDefault();
                    txtStatus.Text = selItem.Description;

                    txtProjectNo.Text        = model.ProjectNumber;
                    txtProjectName.Text      = model.ProjectName;
                    dtProjectDate.Value      = (DateTime)model.ProjectDate;
                    dtProjectStartDate.Value = (DateTime)model.StartDate;
                    dtProjectEndDate.Value   = (DateTime)model.EndDate;

                    // txtBillingAddress.Text = Project_generalInfo.BillingClientAddressID.ToString();
                    // txtClientAddress.Text = Project_generalInfo.SiteClientAddressID.ToString();
                    ServiceProject serviceProject = new ServiceProject();
                    txtBillingAddress.Text   = serviceProject.GetProjectBillingAddress((int)model.PK_ProjectID);
                    txtClientAddress.Text    = serviceProject.GetProjectSiteAddress((int)model.PK_ProjectID);
                    lblCreatedDateTime.Text  = model.CreatedDatetime.ToString();
                    lblModifiedDateTime.Text = model.ModifiedDatetime.ToString();
                    ServiceEmployee       emp  = new ServiceEmployee();
                    List <SelectListItem> lst1 = emp.GetAllEmployees();
                    selItem           = lst1.Where(x => x.ID == model.CreatedBy).FirstOrDefault();
                    lblCreatedBy.Text = selItem.Description;
                    List <SelectListItem> lst2 = emp.GetAllEmployees();
                    selItem            = lst2.Where(x => x.ID == model.ModifiedBy).FirstOrDefault();
                    lblModifiedBy.Text = selItem.Description;

                    TBL_MP_Admin_Company_Master myComp = (new ServiceMASTERS()).MyCompanyInfo();
                    if (myComp != null)
                    {
                        txtCompanyAddress.Text = myComp.Address;
                    }
                }
                else
                {
                    txtProjectNo.Text          = txtProjectName.Text = txtStatus.Text =
                        txtBillingAddress.Text = txtClientAddress.Text = txtCompanyAddress.Text = string.Empty;
                    dtProjectDate.Checked      = dtProjectStartDate.Checked = dtProjectEndDate.Checked = false;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlProjectGeneralInfo::PopulateProjectGeneralInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
            Application.UseWaitCursor = false;
        }
        public void PopulateSalesOrderGeneralInfo()
        {
            this.Cursor = Cursors.WaitCursor;
            ServiceSalesOrder _service = new ServiceSalesOrder();

            try
            {
                //btnApproveSO.Visible = true;
                DoBlanks();
                SelectListItem        selItem = null;
                List <SelectListItem> lst     = _service.GetAllSalesOrderStatuses();

                TBL_MP_CRM_SalesOrder model = (new ServiceSalesOrder()).GetSalesOrderDBInfoByID(SelectedSalesOrderID);
                if (model != null)
                {
                    headerGroupMain.ValuesPrimary.Heading = model.SalesOrderNo;
                    //  lblSOApprovalInfo.Text =model.FK_ApprovedBy.ToString();
                    // lblSOApprovalInfo.StateCommon.Back.Color1 = (model.IsApproved) ? Color.Green : Color.Red;


                    selItem          = lst.Where(x => x.ID == model.FK_SalesOrderStatus).FirstOrDefault();
                    txtSOStatus.Text = selItem.Description;

                    lst              = (new ServiceMASTERS()).GetAllPOSources();
                    selItem          = lst.Where(x => x.ID == model.FK_POSource).FirstOrDefault();
                    txtPOSource.Text = selItem.Description;

                    if (model.MaterialSupplyPONo != null)
                    {
                        txtMaterialSupplyInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}",
                                                                   model.MaterialSupplyPONo,
                                                                   ((DateTime)model.MaterialSupplyPODate).ToString("dd MMM yyyy"),
                                                                   model.MaterialSupplyPOValidDays,
                                                                   ((DateTime)model.MaterialSupplyPOExpiryDate).ToString("dd/MM/yy"));
                    }


                    if (model.InstallationServicePONo != null)
                    {
                        txtInstallationServicesInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}",
                                                                         model.InstallationServicePONo,
                                                                         ((DateTime)model.InstallationServicePODate).ToString("dd MMM yyyy"),
                                                                         model.InstallationServicePOValidDays,
                                                                         ((DateTime)model.InstallationServicePOExpiryDate).ToString("dd/MM/yy"));
                    }
                    if (model.FK_ClientID != null)
                    {
                        txtClientName.Text = String.Format("{0} ({1}) ",
                                                           model.Tbl_MP_Master_Party.PartyName,
                                                           model.Tbl_MP_Master_Party.PartyCode);
                    }
                    if (model.FK_QuotationID != null)
                    {
                        txtQuotationInfo.Text = String.Format("{0} dt. {1} ",
                                                              model.TBL_MP_CRM_SalesQuotation.Quotation_No,
                                                              model.TBL_MP_CRM_SalesQuotation.Quotation_Date.ToString("dd MMM yyyy"));
                    }

                    if (model.FK_ProjectID != null)
                    {
                        headerProject.Values.Heading = "PROJECT: " + model.TBL_MP_PMC_ProjectMaster.ProjectNumber;
                        txtProjectName.Text          = model.TBL_MP_PMC_ProjectMaster.ProjectName;
                        txtStartDate.Text            = model.TBL_MP_PMC_ProjectMaster.StartDate.ToString("dd MMM yyyy");
                        txtEndDate.Text = model.TBL_MP_PMC_ProjectMaster.EndDate.ToString("dd MMM yyyy");
                        ServiceProject serviceProject = new ServiceProject();
                        txtBillingAddress.Text = serviceProject.GetProjectBillingAddress((int)model.FK_ProjectID);
                        txtSiteAddr.Text       = serviceProject.GetProjectSiteAddress((int)model.FK_ProjectID);
                    }

                    if (model.FK_ApprovedBy == null)
                    {
                        lblSOApprovalInfo.Text = "UN-APPROVED";
                        lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Red;
                    }
                    else
                    {
                        lblSOApprovalInfo.Text = string.Format("APPROVED : {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy));
                        lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Green;
                    }

                    if (!ReadOnly)
                    {
                        WhosWhoModel modell = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.SALES_ORDER_FORM_ID).FirstOrDefault();
                        if (modell != null)
                        {
                            if (modell.CanApprove)
                            {
                                if (model.FK_ApprovedBy == null)
                                {
                                    btnApproveSO.Visible = true;
                                }
                                else
                                {
                                    btnApproveSO.Visible = false;
                                }
                            }
                            else
                            {
                                btnApproveSO.Visible = false;
                            }
                        }
                    }

                    /*
                     * lblSOApprovalInfo.Text = "Unapproved Order";
                     * lblSOApprovalInfo.StateCommon.Back.Color1 = (model.FK_ApprovedBy == null) ? Color.Red : Color.Green;
                     * WhosWhoModel premission = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_ORDER).FirstOrDefault();
                     * if (premission != null)
                     * {
                     *   if (premission.CanApprove)
                     *       if (model.FK_ApprovedBy == null)
                     *           btnApproveSO.Visible = true;
                     *       else
                     *       {
                     *           lblSOApprovalInfo.Text = string.Format("Approved: {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy));
                     *           btnApproveSO.Visible = false;
                     *       }
                     *   else
                     *       btnApproveSO.Visible = false;
                     * }
                     */
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(ex.Message, "ControlSalesOrderGeneralInfo::PopulateSalesOrderGeneralInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }