예제 #1
0
        public ProjectsResponse GetProjects([FromBody] ProjectRequest request)
        {
            ProjectsResponse response = new ProjectsResponse();

            try
            {
                if (!BAplication.ValidateAplicationToken(request.ApplicationToken))
                {
                    response.Code    = "2";
                    response.Message = Messages.ApplicationTokenNoAutorize;
                    return(response);
                }

                MProject project = new MProject();
                project.Status    = request.Project.Status;
                project.Title     = request.Project.Title;
                project.StartDate = request.Project.StartDate;
                project.EndDate   = request.Project.EndDate;

                List <MProject> projects = BProject.List(project);

                response.Code     = "0";
                response.Message  = "Success";
                response.Projects = projects.ToArray();
            }
            catch (Exception ex)
            {
                response.Code    = "2";
                response.Message = ex.Message;
            }

            return(response);
        }
예제 #2
0
        public ActionResult AddProjectDetail()
        {
            int    projectId = Request.GetQ("ProjectId").GetInt(0, false);
            string action    = Request.GetQ("action");

            if (projectId <= 0)
            {
                return(Content("FK You! projectId <= 0!"));
            }
            var mProjectDetail  = new MProjectDetail();
            var projectDetailId = 0;

            switch (action)
            {
            case "Edit": {
                projectDetailId = Request.GetQ("ProjectDetailId").GetInt(0, false);
                if (projectDetailId <= 0)
                {
                    return(Content("FK You! projectDetailId <= 0!"));
                }
                mProjectDetail = new BProject().GetProjectDetailModel(projectId, projectDetailId) ?? new MProjectDetail();;
            }; break;
            }
            ViewBag.Action          = action;
            ViewBag.ProjectDetail   = mProjectDetail;
            ViewBag.ProjectDetailId = projectDetailId;
            ViewBag.ProjectId       = projectId;
            return(View());
        }
예제 #3
0
        public ProjectResponse InsertProject([FromBody] ProjectsRequest request)
        {
            ProjectResponse response = new ProjectResponse();

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    if (!BAplication.ValidateAplicationToken(request.ApplicationToken))
                    {
                        response.Code    = "2";
                        response.Message = Messages.ApplicationTokenNoAutorize;
                        return(response);
                    }

                    string webRoot     = _env.ContentRootPath;
                    string rootPath    = _appSettings.Value.rootPath;
                    string ProjectPath = _appSettings.Value.ProjectPath;

                    BaseRequest baseRequest = new BaseRequest();

                    foreach (MProject model in request.Projects)
                    {
                        MProject project = new MProject();

                        project.ProjectCode = model.ProjectCode;
                        project.Description = model.Description;
                        project.Type        = model.Type;
                        project.Status      = model.Status;
                        project.StartDate   = model.StartDate;
                        project.EndDate     = model.EndDate;
                        project.Title       = model.Title;
                        project.AwardId     = model.AwardId;
                        project.AwardStatus = model.AwardStatus;

                        BProject.Insert(project);
                    }

                    response.Code    = "0";
                    response.Message = "Success";

                    scope.Complete();
                }
                catch (Exception ex)
                {
                    response.Code    = "2";
                    response.Message = ex.Message;

                    scope.Dispose();
                }
            }

            return(response);
        }
예제 #4
0
        private void bbProposalLetter_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                SplashScreenManager.Default.SetWaitFormDescription("Bitte warten…");

                if (ObjEProject == null)
                {
                    ObjEProject = new EProject();
                }
                if (ObjBProject == null)
                {
                    ObjBProject = new BProject();
                }
                ObjEProject = ObjBProject.GetPath(ObjEProject);
                var    FolderPath    = new DirectoryInfo(ObjEProject.TemplatePath).GetFiles("V-015*.dotx", SearchOption.AllDirectories).OrderByDescending(d => d.LastWriteTimeUtc).First();
                Object oTemplatePath = ObjEProject.TemplatePath + "\\" + FolderPath;
                if (File.Exists(Convert.ToString(oTemplatePath)))
                {
                    if (!Utility.fileIsOpen(Convert.ToString(oTemplatePath)))
                    {
                        Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application();
                        ap.Documents.Open(oTemplatePath);
                        ap.Visible = true;
                        ap.Activate();
                    }
                    else
                    {
                        throw new Exception("Bitte schließen Sie die Angebots-Dokumente aller Projekte");
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Sequence contains no elements"))
                {
                    XtraMessageBox.Show("Die erforderliche Dokumentenvorlage ist nicht eingestellt!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally { SplashScreenManager.CloseForm(false); }
        }
예제 #5
0
 private void frmCoverSheetPath_Load(object sender, EventArgs e)
 {
     try
     {
         if (ObjBProject == null)
         {
             ObjBProject = new BProject();
         }
         if (ObjEProject == null)
         {
             ObjEProject = new EProject();
         }
         ObjEProject            = ObjBProject.GetPath(ObjEProject);
         txtCoverSheetPath.Text = ObjEProject.CoverSheetPath;
         txtTemplatePath.Text   = ObjEProject.TemplatePath;
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
예제 #6
0
        public ActionResult AddProject()
        {
            string action    = Request.GetQ("action");
            var    mProject  = new MProject();
            int    projectId = 0;

            switch (action)
            {
            case "Edit": {
                projectId = Request.GetQ("ProjectId").GetInt(0, false);
                if (projectId <= 0)
                {
                    return(Content("FK You!"));
                }
                mProject = new BProject().GetProjectModel(projectId);
            }; break;
            }
            ViewBag.Project   = mProject ?? new MProject();
            ViewBag.ProjectId = projectId;
            ViewBag.Action    = action;
            return(View());
        }
예제 #7
0
        /// <summary>
        /// 编辑项目
        /// </summary>
        /// <returns></returns>
        public ActionResult EditProjectDetail()
        {
            int    projectId     = Request.GetF("ProjectId").GetInt(0, false);
            int    projectDetail = Request.GetF("ProjectDetailId").GetInt(0, false);
            string title         = Request.GetF("Title").GetString("");
            string url           = Request.GetF("Url").GetString("");

            if (projectId <= 0 || projectDetail <= 0 || title.IsNullOrWhiteSpace() || url.IsNullOrWhiteSpace())
            {
                return(WriteJson(new {
                    Code = "102",
                    Msg = "参数错误!"
                }));
            }
            var mProjectDetail = new BProject().GetProjectDetailModel(projectId, projectDetail);

            if (mProjectDetail == null)
            {
                return(WriteJson(new {
                    Code = "103",
                    Msg = "参数错误!"
                }));
            }
            mProjectDetail.Title = title;
            mProjectDetail.Url   = url;
            var handerSc = _bllProject.EditProjectDetail(projectId, mProjectDetail);

            if (!handerSc)
            {
                return(WriteJson(new {
                    Code = "104",
                    Msg = "编辑失败!"
                }));
            }
            return(WriteJson(new {
                Code = "100",
                Msg = "编辑成功!"
            }));
        }
예제 #8
0
        private void bbAufmass_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                SplashScreenManager.Default.SetWaitFormDescription("Bitte warten…");
                if (ObjEProject == null)
                {
                    ObjEProject = new EProject();
                }
                if (ObjBProject == null)
                {
                    ObjBProject = new BProject();
                }
                ObjEProject = ObjBProject.GetPath(ObjEProject);

                Object oTemplatePath = ObjEProject.TemplatePath + "\\Aufmass_Template.dotx";
                if (File.Exists(Convert.ToString(oTemplatePath)))
                {
                    if (!Utility.fileIsOpen(Convert.ToString(oTemplatePath)))
                    {
                        Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application();
                        ap.Documents.Open(oTemplatePath);
                        ap.Visible = true;
                        ap.Activate();
                    }
                    else
                    {
                        throw new Exception("Bitte schließen Sie die Aufmass-Dokumente aller Projekte");
                    }
                }
                SplashScreenManager.CloseForm(false);
            }
            catch (Exception ex)
            {
                SplashScreenManager.CloseForm(false);
                Utility.ShowError(ex);
            }
        }
예제 #9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtCoverSheetPath.Text.Trim()))
         {
             throw new Exception("Please Select Valid Cover Sheet Path");
         }
         if (string.IsNullOrEmpty(txtTemplatePath.Text.Trim()))
         {
             throw new Exception("Please Select Valid Template Sheet Path");
         }
         if (ObjBProject == null)
         {
             ObjBProject = new BProject();
         }
         ObjBProject.SavePath(txtCoverSheetPath.Text, txtTemplatePath.Text);
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
예제 #10
0
 private void gvDeleteProject_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgProjectSearch.GetFocusedRowCellValue("ProjectID") != null)
         {
             int IValue = 0;
             if (int.TryParse(Convert.ToString(dgProjectSearch.GetFocusedRowCellValue("ProjectID")), out IValue))
             {
                 var dlgResult = XtraMessageBox.Show("Sind Sie sicher, dass Sie dieses Projekt unwiderruflich löschen möchten?", "Frage", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (Convert.ToString(dlgResult) == "Yes")
                 {
                     string _PrNr = dgProjectSearch.GetFocusedDataRow()["ProjectNumber"].ToString();
                     if (ObjBProject == null)
                     {
                         ObjBProject = new BProject();
                     }
                     ObjBProject.DeleteProject(IValue);
                     dgProjectSearch.DeleteSelectedRows();
                     foreach (Form form in Application.OpenForms)
                     {
                         if (form.Text == _PrNr)
                         {
                             Utility.Isclose = true;
                             form.Close();
                             break;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
예제 #11
0
        /// <summary>
        /// 编辑项目
        /// </summary>
        /// <returns></returns>
        public ActionResult EditProject()
        {
            int    projectId = Request.GetF("ProjectId").GetInt(0, false);
            string typeName  = Request.GetF("TypeName").GetString("");

            if (projectId <= 0)
            {
                return(WriteJson(new {
                    Code = "102",
                    Msg = "参数错误!"
                }));
            }
            var mProject = new BProject().GetProjectModel(projectId);

            if (mProject == null)
            {
                return(WriteJson(new {
                    Code = "103",
                    Msg = "参数错误!"
                }));
            }
            //添加分类
            mProject.TypeName = typeName;
            var handerSc = _bllProject.EditProject(mProject);

            if (!handerSc)
            {
                return(WriteJson(new {
                    Code = "104",
                    Msg = "编辑失败!"
                }));
            }
            return(WriteJson(new {
                Code = "100",
                Msg = "编辑成功!"
            }));
        }
예제 #12
0
 private void gvCopyProject_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgProjectSearch.GetFocusedRowCellValue("ProjectID") != null)
         {
             int IValue = 0;
             if (int.TryParse(Convert.ToString(dgProjectSearch.GetFocusedRowCellValue("ProjectID")), out IValue))
             {
                 frmCopyProject Obj = new frmCopyProject();
                 Obj.ShowDialog();
                 if (!string.IsNullOrEmpty(Obj._NewProjectNumber))
                 {
                     if (ObjBProject == null)
                     {
                         ObjBProject = new BProject();
                     }
                     if (ObjEProject == null)
                     {
                         ObjEProject = new EProject();
                     }
                     ObjEProject.ProjectID     = IValue;
                     ObjEProject.UserID        = Utility.UserID;
                     ObjEProject.ProjectNumber = Obj._NewProjectNumber;
                     ObjEProject = ObjBProject.CopyProject(ObjEProject);
                     BindData();
                     Utility.Setfocus(dgProjectSearch, "ProjectID", ObjEProject.ProjectID);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
예제 #13
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (ObjBProject == null)
            {
                ObjBProject = new BProject();
            }
            DataTable dt = new DataTable();

            dt = ObjBProject.GetProjectCustomerDetails(147);

            dsProposal ds = new dsProposal();
            P_Rpt_PositionForProposalPriceTableAdapter adapter = new P_Rpt_PositionForProposalPriceTableAdapter();

            adapter.Connection.ConnectionString = SQLCon.ConnectionString();
            adapter.ClearBeforeFill             = true;
            adapter.Fill(ds.P_Rpt_PositionForProposalPrice, "", 147, "", "");
            rptProposalPositions rpt = new rptProposalPositions();

            rpt.DataSource = ds;
            rpt.Parameters["ProjectID"].Value       = 147;
            rpt.Parameters["TitleList"].Value       = string.Empty;
            rpt.Parameters["Type"].Value            = "";
            rpt.Parameters["LVSection"].Value       = "";
            rpt.Parameters["ReportName"].Value      = "NEW ANGEBOT REPORT";
            rpt.Parameters["ReportDate"].Value      = DateTime.Now;
            rpt.Parameters["CustomerName"].Value    = dt.Rows[0]["CustomerFullName"];
            rpt.Parameters["CustomerAddress"].Value = dt.Rows[0]["CustomerStreet"];
            rpt.Parameters["ProjectDesc"].Value     = dt.Rows[0]["ProjectDescription"];
            rpt.Parameters["ProjectNumber"].Value   = dt.Rows[0]["ProjectNumber"];
            rpt.CreateDocument();
            rptProposalSummary rptSummary = new rptProposalSummary();

            rptSummary.DataSource = ds;
            rptSummary.Parameters["ProjectID"].Value          = 147;
            rptSummary.Parameters["TitleList"].Value          = string.Empty;
            rptSummary.Parameters["Type"].Value               = "";
            rptSummary.Parameters["LVSection"].Value          = "";
            rptSummary.Parameters["ReportName"].Value         = "NEW ANGEBOT REPORT";
            rptSummary.Parameters["ReportDate"].Value         = DateTime.Now;
            rpt.Parameters["ProjectDesc"].Value               = dt.Rows[0]["ProjectDescription"];
            rpt.Parameters["ProjectNumber"].Value             = dt.Rows[0]["ProjectNumber"];
            rptSummary.Parameters["Vat"].Value                = dt.Rows[0]["Vat"];
            rptSummary.Parameters["AngebotDescription"].Value = dt.Rows[0]["AngebotDescription"];
            rptSummary.CreateDocument();
            rpt.Pages.AddRange(rptSummary.Pages);

            rpt.PrintingSystem.ContinuousPageNumbering = true;
            ReportPrintTool printTool = new ReportPrintTool(rpt);

            printTool.ShowRibbonPreview();



            //rptSampleBreakdown rptMA = new rptSampleBreakdown();
            //ReportPrintTool printTool = new ReportPrintTool(rptMA);
            //rptMA.Parameters["ProjectID"].Value = 113;
            //printTool.ShowRibbonPreview();

            //try
            //{
            //    string strFilePath = string.Empty;
            //    OpenFileDialog dlg = new OpenFileDialog();

            //    dlg.InitialDirectory = @"C:\";
            //    dlg.Title = "Dateiauswahl für Data File Import";

            //    dlg.CheckFileExists = true;
            //    dlg.CheckPathExists = true;

            //    dlg.Filter = "All files (*.*)|*.*";
            //    dlg.RestoreDirectory = true;

            //    dlg.ReadOnlyChecked = true;
            //    dlg.ShowReadOnly = true;
            //    if (dlg.ShowDialog() == DialogResult.OK)
            //    {
            //        strFilePath = dlg.FileName;
            //        string fileExt = Path.GetExtension(strFilePath);
            //        if (fileExt.CompareTo(".xls") == 0 || fileExt.CompareTo(".xlsx") == 0)
            //        {
            //            DataTable dtExcel = new DataTable();
            //            dtExcel = Utility.ReadExcel(strFilePath, fileExt); //read excel file

            //            foreach(DataRow dr in dtExcel.Rows)
            //            {
            //                string str = Convert.ToString(dr["F2"]);
            //                if(str.Substring(0,1) == "\n")
            //                    str = str.Substring(1);
            //                if (str.Contains("\r"))
            //                    str = str.Replace("\r", "");
            //                dr["F2"] = str;
            //            }
            //            DataTable dt = dtExcel.Copy();
            //            BOTTO ObjBOTTO = new BOTTO();
            //            ObjBOTTO.ImportCustomerData(dt);
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Utility.ShowError(ex);
            //}
        }