Esempio n. 1
0
        /// <summary>
        /// /// Business Logic for retreiving the existing project details to show on project screen
        /// </summary>
        /// <param name="ObjEProject"></param>
        public void GetProjectDetails(EProject ObjEProject)
        {
            try
            {
                DataSet dsProjectDetails = ObjDAL.GetProjectDetails(ObjEProject);
                if (dsProjectDetails != null)
                {
                    if (dsProjectDetails.Tables.Count > 4)
                    {
                        ObjEProject.dtQuerCalc = dsProjectDetails.Tables[4];
                    }

                    if (dsProjectDetails.Tables.Count > 3)
                    {
                        ObjEProject.dtArticleSettings = dsProjectDetails.Tables[3];
                    }

                    if (dsProjectDetails.Tables.Count > 2)
                    {
                        ObjEProject.dtDiscount = dsProjectDetails.Tables[2];
                    }

                    if (dsProjectDetails.Tables.Count > 1)
                    {
                        ObjEProject.dtLVSection = dsProjectDetails.Tables[1];
                    }

                    if (dsProjectDetails.Tables.Count > 0)
                    {
                        DataTable dtPRojectDetails = dsProjectDetails.Tables[0];
                        if (dtPRojectDetails != null && dtPRojectDetails.Rows.Count > 0)
                        {
                            int      iValue     = 0;
                            decimal  dValue     = 0;
                            DateTime SubmitDate = DateTime.Now;
                            bool     LockLV     = false;

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["ProjectID"]), out iValue))
                            {
                                ObjEProject.ProjectID = iValue;
                            }
                            else
                            {
                                ObjEProject.ProjectID = -1;
                            }

                            ObjEProject.ProjectNumber    = Convert.ToString(dtPRojectDetails.Rows[0]["ProjectNumber"]);
                            ObjEProject.ProjectName      = Convert.ToString(dtPRojectDetails.Rows[0]["ProjectName"]);
                            ObjEProject.Location         = Convert.ToString(dtPRojectDetails.Rows[0]["Location"]);
                            ObjEProject.CommissionNumber = Convert.ToString(dtPRojectDetails.Rows[0]["ComissionNumber"]);
                            ObjEProject.LVRaster         = Convert.ToString(dtPRojectDetails.Rows[0]["LV_Raster"]);

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["LV_Sprung"]), out iValue))
                            {
                                ObjEProject.LVSprunge = iValue;
                            }

                            if (decimal.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Vat"]), out dValue))
                            {
                                ObjEProject.Vat = dValue;
                            }

                            ObjEProject.ProjectDescription = Convert.ToString(dtPRojectDetails.Rows[0]["ProjectDescription"]);
                            ObjEProject.KundeID            = 1;
                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["CustomerID"]), out iValue))
                            {
                                ObjEProject.KundeNr = iValue;
                            }
                            ObjEProject.KundeName    = Convert.ToString(dtPRojectDetails.Rows[0]["CustomerName"]);
                            ObjEProject.KundeAddress = Convert.ToString(dtPRojectDetails.Rows[0]["Street"]);
                            ObjEProject.PlannedID    = 1;
                            ObjEProject.PlannerName  = Convert.ToString(dtPRojectDetails.Rows[0]["PlannerName"]);

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Planned_Duration"]), out iValue))
                            {
                                ObjEProject.ProjectDuration = iValue;
                            }

                            if (decimal.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Intern_X"]), out dValue))
                            {
                                ObjEProject.InternX = dValue;
                            }

                            if (decimal.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Intern_S"]), out dValue))
                            {
                                ObjEProject.InternS = dValue;
                            }

                            ObjEProject.Submitlocation = Convert.ToString(dtPRojectDetails.Rows[0]["Submit_Location"]);

                            if (DateTime.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Submit_Date"]), out SubmitDate))
                            {
                                ObjEProject.SubmitTime = SubmitDate;
                                ObjEProject.SubmitDate = SubmitDate;
                            }
                            else
                            {
                                ObjEProject.SubmitTime = SubmitDate;
                                ObjEProject.SubmitDate = SubmitDate;
                            }

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Estimated_LV"]), out iValue))
                            {
                                ObjEProject.EstimatedLvs = iValue;
                            }

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Actual_LV"]), out iValue))
                            {
                                ObjEProject.ActualLvs = iValue;
                            }

                            ObjEProject.RoundingPriceID = 1;
                            ObjEProject.Remarks         = Convert.ToString(dtPRojectDetails.Rows[0]["Remarks"]);

                            if (bool.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Lock_LVHierarchy"]), out LockLV))
                            {
                                ObjEProject.LockHierarchy = LockLV;
                            }

                            if (int.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["Round_Off"]), out iValue))
                            {
                                ObjEProject.RoundingPrice = iValue;
                            }

                            if (DateTime.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["ProjectStartDate"]), out SubmitDate))
                            {
                                ObjEProject.ProjectStartDate = SubmitDate;
                            }
                            else
                            {
                                ObjEProject.ProjectStartDate = SubmitDate;
                            }

                            if (DateTime.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["ProjectEndDate"]), out SubmitDate))
                            {
                                ObjEProject.ProjectEndDate = SubmitDate;
                            }
                            else
                            {
                                ObjEProject.ProjectEndDate = SubmitDate;
                            }

                            if (bool.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["IsDisable"]), out LockLV))
                            {
                                ObjEProject.IsDisable = LockLV;
                            }

                            if (bool.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["IsCumulated"]), out LockLV))
                            {
                                ObjEProject.IsCumulated = LockLV;
                            }

                            if (bool.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["FinalInvoice"]), out LockLV))
                            {
                                ObjEProject.IsFinalInvoice = LockLV;
                            }

                            if (bool.TryParse(Convert.ToString(dtPRojectDetails.Rows[0]["ShowVK"]), out LockLV))
                            {
                                ObjEProject.ShowVK = LockLV;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden des Projektes");
                }
                else
                {
                    throw new Exception("Error Occured While Loading the Project");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// /// Business Logic for retreiving the existing project details to show on project screen
        /// </summary>
        /// <param name="ObjEProject"></param>
        public void GetProjectDetails(EProject ObjEProject)
        {
            try
            {
                DataTable dtPRojectDetails = ObjDAL.GetProjectDetails(ObjEProject);
                if (dtPRojectDetails != null && dtPRojectDetails.Rows.Count > 0)
                {
                    int      iValue     = 0;
                    decimal  dValue     = 0;
                    DateTime SubmitDate = DateTime.Now;
                    bool     LockLV     = false;

                    if (int.TryParse(dtPRojectDetails.Rows[0]["ProjectID"].ToString(), out iValue))
                    {
                        ObjEProject.ProjectID = iValue;
                    }
                    else
                    {
                        ObjEProject.ProjectID = -1;
                    }

                    ObjEProject.ProjectNumber    = dtPRojectDetails.Rows[0]["ProjectNumber"].ToString();
                    ObjEProject.Location         = dtPRojectDetails.Rows[0]["Location"].ToString();
                    ObjEProject.CommissionNumber = dtPRojectDetails.Rows[0]["ComissionNumber"].ToString();
                    ObjEProject.LVRaster         = dtPRojectDetails.Rows[0]["LV_Raster"].ToString();

                    if (int.TryParse(dtPRojectDetails.Rows[0]["LV_Sprung"].ToString(), out iValue))
                    {
                        ObjEProject.LVSprunge = iValue;
                    }

                    if (decimal.TryParse(dtPRojectDetails.Rows[0]["Vat"].ToString(), out dValue))
                    {
                        ObjEProject.Vat = dValue;
                    }

                    ObjEProject.ProjectDescription = dtPRojectDetails.Rows[0]["ProjectDescription"].ToString();
                    ObjEProject.KundeID            = 1;
                    ObjEProject.KundeNr            = dtPRojectDetails.Rows[0]["CustomerNumber"].ToString();
                    ObjEProject.KundeName          = dtPRojectDetails.Rows[0]["CustomerName"].ToString();
                    ObjEProject.PlannedID          = 1;
                    ObjEProject.PlannerName        = dtPRojectDetails.Rows[0]["PlannerName"].ToString();

                    if (int.TryParse(dtPRojectDetails.Rows[0]["Planned_Duration"].ToString(), out iValue))
                    {
                        ObjEProject.ProjectDuration = iValue;
                    }

                    if (decimal.TryParse(dtPRojectDetails.Rows[0]["Intern_X"].ToString(), out dValue))
                    {
                        ObjEProject.InternX = dValue;
                    }

                    if (decimal.TryParse(dtPRojectDetails.Rows[0]["Intern_S"].ToString(), out dValue))
                    {
                        ObjEProject.InternS = dValue;
                    }

                    ObjEProject.Submitlocation = dtPRojectDetails.Rows[0]["Submit_Location"].ToString();

                    if (DateTime.TryParse(dtPRojectDetails.Rows[0]["Submit_Date"].ToString(), out SubmitDate))
                    {
                        ObjEProject.SubmitTime = SubmitDate;
                        ObjEProject.SubmitDate = SubmitDate;
                    }
                    else
                    {
                        ObjEProject.SubmitTime = SubmitDate;
                        ObjEProject.SubmitDate = SubmitDate;
                    }

                    if (int.TryParse(dtPRojectDetails.Rows[0]["Estimated_LV"].ToString(), out iValue))
                    {
                        ObjEProject.EstimatedLvs = iValue;
                    }

                    if (int.TryParse(dtPRojectDetails.Rows[0]["Actual_LV"].ToString(), out iValue))
                    {
                        ObjEProject.ActualLvs = iValue;
                    }

                    ObjEProject.RoundingPriceID = 1;
                    ObjEProject.Remarks         = dtPRojectDetails.Rows[0]["Remarks"].ToString();

                    if (bool.TryParse(dtPRojectDetails.Rows[0]["Lock_LVHierarchy"].ToString(), out LockLV))
                    {
                        ObjEProject.LockHierarchy = LockLV;
                    }

                    if (int.TryParse(dtPRojectDetails.Rows[0]["Round_Off"].ToString(), out iValue))
                    {
                        ObjEProject.RoundingPrice = iValue;
                    }

                    if (DateTime.TryParse(dtPRojectDetails.Rows[0]["ProjectStartDate"].ToString(), out SubmitDate))
                    {
                        ObjEProject.ProjectStartDate = SubmitDate;
                    }
                    else
                    {
                        ObjEProject.ProjectStartDate = SubmitDate;
                    }

                    if (DateTime.TryParse(dtPRojectDetails.Rows[0]["ProjectEndDate"].ToString(), out SubmitDate))
                    {
                        ObjEProject.ProjectEndDate = SubmitDate;
                    }
                    else
                    {
                        ObjEProject.ProjectEndDate = SubmitDate;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error Occured While Loading the Project");
            }
        }