Exemple #1
0
        public int GetCirRefIDPK(string ci_reference)
        {
            try
            {
                //int ci_idpk;

                DDCI_INFO ci_idpk = ((from c in DB.DDCI_INFO
                                      where c.CI_REFERENCE == ci_reference
                                      orderby c.CI_REFERENCE ascending
                                      select c).FirstOrDefault <DDCI_INFO>());
                if (ci_idpk != null)
                {
                    if (string.IsNullOrEmpty(ci_idpk.IDPK.ToString()) == false)
                    {
                        return(ci_idpk.IDPK);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
        private void ExportToExcelData()
        {
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.DefaultExt = ".xlsx";
            dlg.Filter     = "Excel File (*.xls, *.xlsx)|*.xls;*.xlsx";
            dlg.ShowDialog();
            if (!dlg.FileName.IsNotNullOrEmpty())
            {
                return;
            }
            PRD_MAST productMaster = new PRD_MAST()
            {
                PART_NO = MandatoryFields.PART_NO
            };
            DDCI_INFO customerInfo = null;
            DataSet   dsReport     = bll.GetAllMFM(Convert.ToDateTime(StartDate).ToString("MM/dd/yyyy"), Convert.ToDateTime(EndDate).ToString("MM/dd/yyyy"), productMaster, customerInfo, DDCUST_MAST);
            DataView  dv           = dsReport.Tables[0].DefaultView;
            DataTable dt           = dv.ToTable();

            if (dlg.FileName != "")
            {
                dt.ExportMFMToExcel(dlg.FileName);
                ShowInformationMessage("Successfully Exported to Excel");
            }
        }
Exemple #3
0
        public List <DDCI_INFO> GetCustomerPartNumber(DDCI_INFO paramEntity = null)
        {
            List <DDCI_INFO> lstEntity = null;

            try
            {
                if (!DB.IsNotNullOrEmpty())
                {
                    return(lstEntity);
                }
                if (paramEntity.IsNotNullOrEmpty() && paramEntity.IDPK.IsNotNullOrEmpty())
                {
                    lstEntity = (from row in DB.DDCI_INFO
                                 where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) && row.IDPK == paramEntity.IDPK
                                 select row).ToList <DDCI_INFO>();
                }
                else
                {
                    lstEntity = (from row in DB.DDCI_INFO
                                 where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null)
                                 select row).ToList <DDCI_INFO>();
                }
                if (lstEntity.IsNotNullOrEmpty())
                {
                    lstEntity = lstEntity.GroupBy(row => row.CUST_DWG_NO).Select(row => row.First()).OrderBy(row => row.CUST_DWG_NO).Distinct <DDCI_INFO>().ToList <DDCI_INFO>();
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }

            return(lstEntity);
        }
Exemple #4
0
        public void AllotPartNo()
        {
            int       idpk   = 0;
            DDCI_INFO entity = null;
            bool      submit = false;

            try
            {
                if (SelectedCostSheet == null)
                {
                    Message = "CI Reference should be Selected";
                    return;
                }
                idpk   = SelectedCostSheet["CI_INFO_PK"].ToValueAsString().ToIntValue();
                entity = (from row in _costSheetSearchbll.DB.DDCI_INFO
                          where (row.DELETE_FLAG == false || row.DELETE_FLAG == null) &&
                          row.IDPK == idpk
                          select row).FirstOrDefault <DDCI_INFO>();
                if (entity != null)
                {
                    if (entity.ALLOT_PART_NO == null || entity.ALLOT_PART_NO == 0)
                    {
                        entity.ALLOT_PART_NO    = 1;
                        entity.PART_NO_REQ_DATE = _costSheetSearchbll.ServerDateTime();
                        submit = true;
                        _costSheetSearchbll.DB.SubmitChanges();
                        Message = "Part No Requested";
                        //entity
                        //entity.PART_NO_REQ_DATE = _cost
                    }
                    else
                    {
                        if (entity.ALLOT_PART_NO == 1)
                        {
                            Message = "Request for Part No allocation already made";
                        }
                        else
                        {
                            Message = "Part No already allocated";
                        }
                    }
                }
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                _costSheetSearchbll.DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges);
            }
            catch (Exception ex)
            {
                if (submit == true)
                {
                    if (entity != null)
                    {
                        _costSheetSearchbll.DB.DDCOST_CENT_MAST.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, entity);
                    }
                }
                throw ex.LogException();
            }
        }
        private void RefreshSubmitCommand()
        {
            if (StartDate.ToValueAsString().Trim() == "")
            {
                ShowInformationMessage(PDMsg.NotEmpty("Start Date"));
                return;
            }
            if (EndDate.ToValueAsString().Trim() == "")
            {
                ShowInformationMessage(PDMsg.NotEmpty("End Date"));
                return;
            }
            if (StartDate > EndDate)
            {
                ShowInformationMessage("Start Date is Greater than End Date,Please Check it.!");
                return;
            }
            PRD_MAST productMaster = new PRD_MAST()
            {
                PART_NO = MandatoryFields.PART_NO
            };
            DDCI_INFO customerInfo = null;

            DataSet dsReport = bll.GetAllMFM(Convert.ToDateTime(StartDate).ToString("MM/dd/yyyy"), Convert.ToDateTime(EndDate).ToString("MM/dd/yyyy"), productMaster, customerInfo, DDCUST_MAST);

            MandatoryFields.GRID_TITLE = REPORT_TITLE;
            //for (int i = 0; i < dsReport.Tables[0].Rows.Count; i++)
            //{
            //    string date = Convert.ToDateTime(dsReport.Tables[0].Rows[i]["DOC_REL_DT_PLAN"].ToString()).ToShortDateString();
            //}
            foreach (DataRow dr in dsReport.Tables[0].Rows)
            {
                dr["DOC_REL_DT_PLAN"]        = string.IsNullOrEmpty(dr["DOC_REL_DT_PLAN"].ToString()) ? null : DateTime.Parse((dr["DOC_REL_DT_PLAN"].ToString())).ToString("dd/MM/yyyy");
                dr["DOC_REL_DT_ACTUAL"]      = string.IsNullOrEmpty(dr["DOC_REL_DT_ACTUAL"].ToString()) ? null : DateTime.Parse((dr["DOC_REL_DT_ACTUAL"].ToString())).ToString("dd/MM/yyyy");
                dr["TOOLS_READY_DT_PLAN"]    = string.IsNullOrEmpty(dr["TOOLS_READY_DT_PLAN"].ToString()) ? null : DateTime.Parse((dr["TOOLS_READY_DT_PLAN"].ToString())).ToString("dd/MM/yyyy");
                dr["TOOLS_READY_ACTUAL_DT"]  = string.IsNullOrEmpty(dr["TOOLS_READY_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["TOOLS_READY_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["FORGING_PLAN_DT"]        = string.IsNullOrEmpty(dr["FORGING_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["FORGING_PLAN_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["FORGING_ACTUAL_DT"]      = string.IsNullOrEmpty(dr["FORGING_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["FORGING_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["SECONDARY_PLAN_DT"]      = string.IsNullOrEmpty(dr["SECONDARY_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["SECONDARY_PLAN_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["SECONDARY_ACTUAL_DT"]    = string.IsNullOrEmpty(dr["SECONDARY_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["SECONDARY_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["HEAT_TREATMENT_PLAN_DT"] = string.IsNullOrEmpty(dr["HEAT_TREATMENT_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["HEAT_TREATMENT_PLAN_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["HEAT_TREATMENT_ACTUAL"]  = string.IsNullOrEmpty(dr["HEAT_TREATMENT_ACTUAL"].ToString()) ? null : DateTime.Parse((dr["HEAT_TREATMENT_ACTUAL"].ToString())).ToString("dd/MM/yyyy");
                dr["ISSR_PLAN_DT"]           = string.IsNullOrEmpty(dr["ISSR_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["ISSR_PLAN_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["ISSR_ACTUAL_DT"]         = string.IsNullOrEmpty(dr["ISSR_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["ISSR_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["PPAP_PLAN"]      = string.IsNullOrEmpty(dr["PPAP_PLAN"].ToString()) ? null : DateTime.Parse((dr["PPAP_PLAN"].ToString())).ToString("dd/MM/yyyy");
                dr["PPAP_ACTUAL_DT"] = string.IsNullOrEmpty(dr["PPAP_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["PPAP_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy");
                dr["PSW_DATE"]       = string.IsNullOrEmpty(dr["PSW_DATE"].ToString()) ? null : DateTime.Parse((dr["PSW_DATE"].ToString())).ToString("dd/MM/yyyy");
            }
            if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count <= 0)
            {
                return;
            }

            MandatoryFields.GridData   = dsReport.Tables[0].DefaultView;
            MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries";
        }
Exemple #6
0
        public bool InsertDDCIInfo(string varOldCIref, string varNewCIref)
        {
            List <DDCI_INFO> lstOldDDCI  = new List <DDCI_INFO>();
            DDCI_INFO        ddciinfonew = new DDCI_INFO();
            DDCI_INFO        ddciinfoold = new DDCI_INFO();
            CultureInfo      provider    = CultureInfo.InvariantCulture;


            try
            {
                lstOldDDCI = (from row in DB.DDCI_INFO
                              where (row.DELETE_FLAG == false || row.DELETE_FLAG == null) &&
                              row.CI_REFERENCE.Trim() == varOldCIref.Trim()
                              select row).ToList <DDCI_INFO>();


                if (lstOldDDCI.Count > 0)
                {
                    ddciinfonew = new DDCI_INFO();
                    ddciinfoold = lstOldDDCI[0];
                    ddciinfonew = ddciinfoold.DeepCopy();
                    ddciinfonew.CI_REFERENCE      = varNewCIref;
                    ddciinfonew.IDPK              = 0;
                    ddciinfonew.CUST_DWG_NO       = "";
                    ddciinfonew.FR_CS_DATE        = null;
                    ddciinfonew.CUST_DWG_NO_ISSUE = "";
                    ddciinfonew.ENQU_RECD_ON      = null;
                    ddciinfonew.FR_CS_DATE        = serverDate;
                    ddciinfonew.ROWID             = Guid.NewGuid();
                    ddciinfonew.ENQU_RECD_ON      = DateTime.ParseExact(varNewCIref.Substring(5, 2) + "/" +
                                                                        varNewCIref.Substring(3, 2) + "/" +
                                                                        varNewCIref.Substring(1, 2), "dd/MM/yy", provider);
                    ddciinfonew.UPDATED_BY   = null;
                    ddciinfonew.UPDATED_DATE = null;
                    ddciinfonew.ENTERED_BY   = userInformation.UserName;
                    ddciinfonew.ENTERED_DATE = serverDateTime;
                    DB.DDCI_INFO.InsertOnSubmit(ddciinfonew);
                    DB.SubmitChanges();
                }
                return(true);
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges);
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
            return(true);
        }
Exemple #7
0
 private void CopyData()
 {
     try
     {
         bool   blnok       = false;
         string varOldCIref = "";
         FeasibleReportAndCostSheet frcs;
         Window           win          = new Window();
         DDCI_INFO        activeEntity = new DDCI_INFO();
         DDCI_INFO        getEntity    = new DDCI_INFO();
         List <DDCI_INFO> lstEntity    = new List <DDCI_INFO>();
         if (SelectedCostSheet == null)
         {
             Message = "CI Reference should be Selected";
             return;
         }
         getEntity.IDPK = SelectedCostSheet["CI_INFO_PK"].ToValueAsString().ToIntValue();
         frcs           = new FeasibleReportAndCostSheet(_userInformation);
         lstEntity      = frcs.GetEntitiesByPrimaryKey(getEntity);
         if (lstEntity.Count == 0)
         {
             return;
         }
         activeEntity = lstEntity[0];
         frmCopyCIReference userControl = new frmCopyCIReference(_userInformation, win, activeEntity.DeepCopy <DDCI_INFO>(), OperationMode.AddNew);
         win.Title                 = "Copy Data";
         win.Content               = userControl;
         win.Height                = userControl.Height + 50;
         win.Width                 = userControl.Width + 10;
         win.ShowInTaskbar         = true;
         win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
         win.WindowState           = WindowState.Normal;
         win.ResizeMode            = ResizeMode.NoResize;
         win.ShowDialog();
         if (userControl.Vm.Reload == true)
         {
             SearchCostSheet();
             SelectedCostSheet = dvCostSheetSearch[0];
             NotifyPropertyChanged("SelectedCostSheet");
         }
         //CIReferenceDataSource = bll.GetCIReferenceNumber().ToDataTable<V_CI_REFERENCE_NUMBER>().DefaultView;
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
Exemple #8
0
        private void MarkAsSubmitted()
        {
            int       idpk   = 0;
            DDCI_INFO entity = null;
            bool      submit = false;

            try
            {
                if (SelectedCostSheet == null)
                {
                    Message = "CI Reference should be Selected";
                    return;
                }
                idpk   = SelectedCostSheet["CI_INFO_PK"].ToValueAsString().ToIntValue();
                entity = (from row in _costSheetSearchbll.DB.DDCI_INFO
                          where (row.DELETE_FLAG == false || row.DELETE_FLAG == null) &&
                          row.IDPK == idpk
                          select row).FirstOrDefault <DDCI_INFO>();
                if (entity != null)
                {
                    //Righ click - Mark as submitted - set 0 for Pending column - 17/12/2015
                    entity.PENDING = "0";
                    submit         = true;
                    _costSheetSearchbll.DB.SubmitChanges();
                    Message = "Selected CI Reference has been marked as submitted";
                }
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                _costSheetSearchbll.DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges);
            }
            catch (Exception ex)
            {
                if (submit == true)
                {
                    if (entity != null)
                    {
                        _costSheetSearchbll.DB.DDCOST_CENT_MAST.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, entity);
                    }
                }
                throw ex.LogException();
            }
        }
        public frmCopyCIReference(UserInformation userInformation, Window mdiChild, DDCI_INFO activeentity, OperationMode operationMode)
        {
            InitializeComponent();
            bll = new FeasibleReportAndCostSheet(userInformation);
            this.ActiveEntity = activeentity;

            Vm = new CopyCIReferenceViewModel(userInformation, activeentity, operationMode);
            this.DataContext = Vm;
            if (Vm.CloseAction == null && mdiChild.IsNotNullOrEmpty())
            {
                Vm.CloseAction = new Action(() => mdiChild.Close());
            }

            bll = new FeasibleReportAndCostSheet(userInformation);

            List <ProcessDesigner.Model.V_TABLE_DESCRIPTION> lstTableDescription = bll.GetTableColumnsSize("DDCI_INFO");

            this.SetColumnLength <TextBox>(lstTableDescription);
        }
Exemple #10
0
 public bool CheckCIRefIsthere(string ciref)
 {
     try
     {
         DDCI_INFO ddciInfo = (from o in DB.DDCI_INFO.AsEnumerable()
                               where o.CI_REFERENCE == ciref.ToString().Trim() &&
                               ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                               select o).FirstOrDefault <DDCI_INFO>();
         if (ddciInfo != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
Exemple #11
0
        private void PrintSubmitCommand()
        {
            PRD_MAST productMaster = new PRD_MAST()
            {
                PART_NO = MandatoryFields.PART_NO
            };
            DDCI_INFO customerInfo = new DDCI_INFO()
            {
                CUST_DWG_NO = MandatoryFields.CUST_DWG_NO
            };

            DataSet dsReport = bll.GetAllCustomerPartNos(productMaster, customerInfo, CustomerSelectedRow);

            MandatoryFields.GRID_TITLE = REPORT_TITLE;
            if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0)
            {
                ShowInformationMessage(PDMsg.NoRecordsPrint);
                return;
            }

            dsReport.DataSetName       = REPORT_NAME;
            MandatoryFields.GridData   = dsReport.Tables[0].DefaultView;
            MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries";
            DataRow row = dsReport.Tables[1].Rows.Add();

            row["ReportTitle"] = REPORT_TITLE;
            row.AcceptChanges();
            dsReport.Tables[1].AcceptChanges();

            //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml");

            frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME);

            if (!reportViewer.ReadyToShowReport)
            {
                return;
            }
            reportViewer.ShowDialog();
        }
Exemple #12
0
        private void RefreshSubmitCommand()
        {
            PRD_MAST productMaster = new PRD_MAST()
            {
                PART_NO = MandatoryFields.PART_NO
            };
            DDCI_INFO customerInfo = new DDCI_INFO()
            {
                CUST_DWG_NO = MandatoryFields.CUST_DWG_NO
            };

            DataSet dsReport = bll.GetAllCustomerPartNos(productMaster, customerInfo, CustomerSelectedRow);

            MandatoryFields.GRID_TITLE = REPORT_TITLE;
            if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count <= 0)
            {
                MandatoryFields.GridData = null;
                return;
            }

            MandatoryFields.GridData   = dsReport.Tables[0].DefaultView;
            MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries";
        }
Exemple #13
0
        public ReportMISCustomerPartNoWiseViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = REPORT_TITLE)
        {
            _userInformation = userInformation;
            this.mdiChild    = mdiChild;

            bll                        = new ReportMISCustomerPartNoWise(userInformation);
            MandatoryFields            = new ReportMISCustomerPartNoWiseModel();
            MandatoryFields.GRID_TITLE = REPORT_TITLE;

            CustomersDataSource = bll.GetCustomerDetails().ToDataTable <DDCUST_MAST>().DefaultView;
            this.customerSelectedItemChangedCommand = new DelegateCommand(this.CustomerChanged);
            CustomerDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "25*"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_NAME", ColumnDesc = "Customer", ColumnWidth = "75*", IsDefaultSearchColumn = true
                }
            };

            SFLPartNumbersDataSource = bll.GetPartNumber().ToDataTable <PRD_MAST>().DefaultView;
            this.sflPartNumberSelectedItemChangedCommand = new DelegateCommand(this.SFLPartNumberChanged);
            SFLPartNumberDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "PART_NO", ColumnDesc = "SFL Part Number", ColumnWidth = "1*"
                },
            };


            this.printCommand   = new DelegateCommand(this.PrintSubmitCommand);
            this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand);

            CustomerPartNumbersDataSource = bll.GetCustomerPartNumber().ToDataTable <DDCI_INFO>().DefaultView;
            this.customerPartNumberSelectedItemChangedCommand = new DelegateCommand(this.CustomerPartNumberChanged);
            CustomerPartNumberDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "CUST_DWG_NO", ColumnDesc = "Customer Part Number", ColumnWidth = "1*"
                },
            };
        }
        public ReportMISMFMViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = REPORT_TITLE)
        {
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "dd/MM/yyyy";
            ci.DateTimeFormat.DateSeparator     = "/";
            Thread.CurrentThread.CurrentCulture = ci;

            _userInformation = userInformation;
            this.mdiChild    = mdiChild;

            bll                        = new ReportMISMFM(userInformation);
            MandatoryFields            = new ReportMISMFMModel();
            MandatoryFields.GRID_TITLE = REPORT_TITLE;

            CustomersDataSource = bll.GetCustomerDetails().ToDataTable <DDCUST_MAST>().DefaultView;
            this.customerSelectedItemChangedCommand = new DelegateCommand(this.CustomerChanged);
            CustomerDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "25*"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_NAME", ColumnDesc = "Customer", ColumnWidth = "75*", IsDefaultSearchColumn = true
                }
            };

            SFLPartNumbersDataSource = bll.GetPartNumber().ToDataTable <PRD_MAST>().DefaultView;
            this.sflPartNumberSelectedItemChangedCommand = new DelegateCommand(this.SFLPartNumberChanged);
            SFLPartNumberDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "PART_NO", ColumnDesc = "SFL Part Number", ColumnWidth = "1*"
                },
            };


            this.printCommand   = new DelegateCommand(this.PrintSubmitCommand);
            this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand);
            this.ExportCommand  = new DelegateCommand(this.ExportToExcelData);
        }
        public List <DDCI_INFO> GetCustomerPartNumber(DDCI_INFO paramEntity = null)
        {
            List <DDCI_INFO> lstEntity = null;

            try
            {
                if (!DB.IsNotNullOrEmpty())
                {
                    return(lstEntity);
                }
                if (paramEntity.IsNotNullOrEmpty() && paramEntity.IDPK.IsNotNullOrEmpty())
                {
                    lstEntity = (from row in DB.DDCI_INFO
                                 where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) && row.IDPK == paramEntity.IDPK
                                 select row).ToList <DDCI_INFO>();
                }
                else
                {
                    lstEntity = (from row in DB.DDCI_INFO
                                 where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null)
                                 select row).ToList <DDCI_INFO>();
                }
                if (lstEntity.IsNotNullOrEmpty())
                {
                    lstEntity = lstEntity.GroupBy(row => ((row.CUST_DWG_NO == null || Convert.ToString(row.CUST_DWG_NO).Trim().Length == 0) ? null : Convert.ToString(row.CUST_DWG_NO).Trim())).Select(row => new DDCI_INFO()
                    {
                        CI_REFERENCE       = row.First().CI_REFERENCE,
                        ENQU_RECD_ON       = row.First().ENQU_RECD_ON,
                        FR_CS_DATE         = row.First().FR_CS_DATE,
                        PROD_DESC          = row.First().PROD_DESC,
                        CUST_CODE          = row.First().CUST_CODE,
                        CUST_DWG_NO        = ((row.First().CUST_DWG_NO == null || Convert.ToString(row.First().CUST_DWG_NO).Trim().Length == 0) ? null : Convert.ToString(row.First().CUST_DWG_NO).Trim()),
                        CUST_DWG_NO_ISSUE  = row.First().CUST_DWG_NO_ISSUE,
                        EXPORT             = row.First().EXPORT,
                        NUMBER_OFF         = row.First().NUMBER_OFF,
                        POTENTIAL          = row.First().POTENTIAL,
                        SFL_SHARE          = row.First().SFL_SHARE,
                        REMARKS            = row.First().REMARKS,
                        RESPONSIBILITY     = row.First().RESPONSIBILITY,
                        PENDING            = row.First().PENDING,
                        FEASIBILITY        = row.First().FEASIBILITY,
                        REJECT_REASON      = row.First().REJECT_REASON,
                        LOC_CODE           = row.First().LOC_CODE,
                        CHEESE_WT          = row.First().CHEESE_WT,
                        FINISH_WT          = row.First().FINISH_WT,
                        FINISH_CODE        = row.First().FINISH_CODE,
                        SUGGESTED_RM       = row.First().SUGGESTED_RM,
                        RM_COST            = row.First().RM_COST,
                        FINAL_COST         = row.First().FINAL_COST,
                        COST_NOTES         = row.First().COST_NOTES,
                        PROCESSED_BY       = row.First().PROCESSED_BY,
                        ORDER_DT           = row.First().ORDER_DT,
                        PRINT              = row.First().PRINT,
                        ALLOT_PART_NO      = row.First().ALLOT_PART_NO,
                        PART_NO_REQ_DATE   = row.First().PART_NO_REQ_DATE,
                        CUST_STD_NO        = row.First().CUST_STD_NO,
                        CUST_STD_DATE      = row.First().CUST_STD_DATE,
                        AUTOPART           = row.First().AUTOPART,
                        SAFTYPART          = row.First().SAFTYPART,
                        APPLICATION        = row.First().APPLICATION,
                        STATUS             = row.First().STATUS,
                        CUSTOMER_NEED_DT   = row.First().CUSTOMER_NEED_DT,
                        MKTG_COMMITED_DT   = row.First().MKTG_COMMITED_DT,
                        PPAP_LEVEL         = row.First().PPAP_LEVEL,
                        DEVL_METHOD        = row.First().DEVL_METHOD,
                        PPAP_FORGING       = row.First().PPAP_FORGING,
                        PPAP_SAMPLE        = row.First().PPAP_SAMPLE,
                        PACKING            = row.First().PACKING,
                        NATURE_PACKING     = row.First().NATURE_PACKING,
                        SPL_CHAR           = row.First().SPL_CHAR,
                        OTHER_CUST_REQ     = row.First().OTHER_CUST_REQ,
                        ATP_DATE           = row.First().ATP_DATE,
                        SIMILAR_PART_NO    = row.First().SIMILAR_PART_NO,
                        GENERAL_REMARKS    = row.First().GENERAL_REMARKS,
                        MONTHLY            = row.First().MONTHLY,
                        MKTG_COMMITED_DATE = row.First().MKTG_COMMITED_DATE,
                        ROWID              = row.First().ROWID,
                        DELETE_FLAG        = row.First().DELETE_FLAG,
                        ENTERED_DATE       = row.First().ENTERED_DATE,
                        ENTERED_BY         = row.First().ENTERED_BY,
                        UPDATED_DATE       = row.First().UPDATED_DATE,
                        UPDATED_BY         = row.First().UPDATED_BY,
                        IDPK         = row.First().IDPK,
                        COATING_CODE = row.First().COATING_CODE,
                        REALISATION  = row.First().REALISATION,
                        NO_OF_PCS    = row.First().NO_OF_PCS,
                        ZONE_CODE    = row.First().ZONE_CODE,
                        RM_FACTOR    = row.First().RM_FACTOR,
                        IS_COMBINED  = row.First().IS_COMBINED,
                    }).OrderBy(row => ((row.CUST_DWG_NO == null || Convert.ToString(row.CUST_DWG_NO).Trim().Length == 0) ? null : Convert.ToString(row.CUST_DWG_NO).Trim())).Distinct <DDCI_INFO>().ToList <DDCI_INFO>();
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }

            return(lstEntity);
        }
        public CopyCIReferenceViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, DDCI_INFO oldActiveEntity,
                                        OperationMode operationMode)
        {
            bll = new FeasibleReportAndCostSheet(userInformation);

            EnquiryReceivedOn = bll.ServerDateTime();

            OldCIReferenceDataSource  = bll.GetCIReferenceNumber().ToDataTable <V_CI_REFERENCE_NUMBER>().DefaultView;
            CIReferenceZoneDataSource = bll.GetZoneDetails().ToDataTable <CI_REFERENCE_ZONE>().DefaultView;

            OldActiveEntity = oldActiveEntity;

            if (!OldActiveEntity.IsNotNullOrEmpty())
            {
                OldActiveEntity = new DDCI_INFO();
            }
            EntityPrimaryKey = oldActiveEntity.IDPK;

            #region DropdownColumns Settins
            CiReferenceZoneDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "CODE", ColumnDesc = "Zone Code", ColumnWidth = "25*"
                },
                new DropdownColumns()
                {
                    ColumnName = "DESCRIPTION", ColumnDesc = "Zone", ColumnWidth = "75*"
                }
            };

            OldCIReferenceDropDownItems = new ObservableCollection <DropdownColumns>()
            {
                new DropdownColumns()
                {
                    ColumnName = "CI_REFERENCE", ColumnDesc = "CI Reference", ColumnWidth = "90"
                },
                new DropdownColumns()
                {
                    ColumnName = "FRCS_DATE", ColumnDesc = "FRCS Date", ColumnWidth = "80"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_DWG_NO", ColumnDesc = "Drawing No.", ColumnWidth = "100"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "100"
                },
                new DropdownColumns()
                {
                    ColumnName = "FINISH_CODE", ColumnDesc = "Finish Code", ColumnWidth = "80"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_DWG_NO_ISSUE", ColumnDesc = "Customer Drawing Issue No.", ColumnWidth = "175"
                },
                new DropdownColumns()
                {
                    ColumnName = "CUST_STD_DATE", ColumnDesc = "Customer STD Date ", ColumnWidth = "150"
                }
            };

            #endregion

            this.ciReferenceEndEditCommand = new DelegateCommand(this.ciReferenceEndEdit);
            this.oldReferenceSelectedItemChangedCommand = new DelegateCommand(this.OldCIReferenceChanged);

            this.enquiryReceivedOnChangedCommand = new DelegateCommand(this.EnquiryReceivedOnChanged);
            this.saveCommand = new DelegateCommand(this.SaveSubmitCommand);
            this.ciReferenceZoneSelectedItemChangedCommand = new DelegateCommand(this.CIReferenceZoneChanged);

            ActionPermission        = bll.GetUserRights("CIReferenceCopy");
            ActionPermission.AddNew = true;
            ActionPermission.Edit   = true;
            ActionPermission.Save   = true;
            ActionPermission.Close  = true;
            ActionPermission.Print  = true;

            ActionMode = operationMode;
        }
 private void ClearAll(DDCI_INFO entity)
 {
     try
     {
         if (entity.IsNotNullOrEmpty())
         {
             entity.CI_REFERENCE = null;
             //ActiveEntity.ENQU_RECD_ON = EnquiryReceivedOn();
             entity.FR_CS_DATE         = null;
             entity.PROD_DESC          = string.Empty;
             entity.CUST_CODE          = null;
             entity.CUST_DWG_NO        = string.Empty;
             entity.CUST_DWG_NO_ISSUE  = string.Empty;
             entity.EXPORT             = string.Empty;
             entity.NUMBER_OFF         = 0.0m;
             entity.POTENTIAL          = 0.0m;
             entity.SFL_SHARE          = 0.0m;
             entity.REMARKS            = string.Empty;
             entity.RESPONSIBILITY     = null;
             entity.PENDING            = string.Empty;
             entity.FEASIBILITY        = string.Empty;
             entity.REJECT_REASON      = string.Empty;
             entity.LOC_CODE           = null;
             entity.CHEESE_WT          = 0.0m;
             entity.FINISH_WT          = 0.0m;
             entity.FINISH_CODE        = null;
             entity.COATING_CODE       = null;
             entity.SUGGESTED_RM       = null;
             entity.RM_COST            = 0.0m;
             entity.FINAL_COST         = 0.0m;
             entity.COST_NOTES         = string.Empty;
             entity.PROCESSED_BY       = null;
             entity.ORDER_DT           = null;
             entity.PRINT              = string.Empty;
             entity.ALLOT_PART_NO      = 0.0m;
             entity.PART_NO_REQ_DATE   = null;
             entity.CUST_STD_NO        = string.Empty;
             entity.CUST_STD_DATE      = null;
             entity.AUTOPART           = string.Empty;
             entity.SAFTYPART          = string.Empty;
             entity.APPLICATION        = string.Empty;
             entity.STATUS             = 0.0m;
             entity.CUSTOMER_NEED_DT   = null;
             entity.MKTG_COMMITED_DT   = null;
             entity.PPAP_LEVEL         = string.Empty;
             entity.DEVL_METHOD        = 0.0m;
             entity.PPAP_FORGING       = 0.0m;
             entity.PPAP_SAMPLE        = 0.0m;
             entity.PACKING            = 0.0m;
             entity.NATURE_PACKING     = string.Empty;
             entity.SPL_CHAR           = 0.0m;
             entity.OTHER_CUST_REQ     = string.Empty;
             entity.ATP_DATE           = null;
             entity.SIMILAR_PART_NO    = string.Empty;
             entity.GENERAL_REMARKS    = string.Empty;
             entity.MONTHLY            = 0.0m;
             entity.MKTG_COMMITED_DATE = null;
         }
         //if (CIReferenceDataSource.IsNotNullOrEmpty()) CIReferenceDataSource.RowFilter = null;
         //if (CIReferenceZoneDataSource.IsNotNullOrEmpty()) CIReferenceZoneDataSource.RowFilter = null;
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
Exemple #18
0
        public bool SaveRecord(RPDModel rpdmodeldata)
        {
            GenerateNextNumber("DDCI_INFO", "IDPK").ToIntValue();

            DDCI_INFO ddciInfo = (from o in DB.DDCI_INFO.AsEnumerable()
                                  where o.CI_REFERENCE == rpdmodeldata.CI_REFERENCE && o.IDPK == rpdmodeldata.IDPK &&
                                  ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                  select o).FirstOrDefault <DDCI_INFO>();



            if (ddciInfo != null)
            {
                // ddciInfo.CI_REFERENCE = RPDModelData.CI_REFERENCE;
                ddciInfo.ENQU_RECD_ON      = rpdmodeldata.ENQU_RECD_ON;
                ddciInfo.FR_CS_DATE        = rpdmodeldata.FR_CS_DATE;
                ddciInfo.PROD_DESC         = rpdmodeldata.PROD_DESC;
                ddciInfo.CUST_CODE         = rpdmodeldata.CUST_CODE;
                ddciInfo.CUST_DWG_NO       = rpdmodeldata.CUST_DWG_NO;
                ddciInfo.CUST_DWG_NO_ISSUE = rpdmodeldata.CUST_DWG_NO_ISSUE;
                ddciInfo.EXPORT            = rpdmodeldata.EXPORT;
                ddciInfo.NUMBER_OFF        = rpdmodeldata.NUMBER_OFF;
                ddciInfo.POTENTIAL         = rpdmodeldata.POTENTIAL.ToDecimalValue();
                ddciInfo.SFL_SHARE         = rpdmodeldata.SFL_SHARE;
                ddciInfo.REMARKS           = rpdmodeldata.REMARKS;
                ddciInfo.RESPONSIBILITY    = rpdmodeldata.RESPONSIBILITY;
                ddciInfo.PENDING           = rpdmodeldata.PENDING;
                ddciInfo.FEASIBILITY       = rpdmodeldata.FEASIBILITY;
                ddciInfo.REJECT_REASON     = rpdmodeldata.REJECT_REASON;
                ddciInfo.LOC_CODE          = rpdmodeldata.LOC_CODE;
                ddciInfo.CHEESE_WT         = rpdmodeldata.CHEESE_WT;
                ddciInfo.FINISH_WT         = rpdmodeldata.FINISH_WT;
                //  ddciInfo.FINISH_CODE = RPDModelData.FINISH_CODE;
                ddciInfo.SUGGESTED_RM     = rpdmodeldata.SUGGESTED_RM;
                ddciInfo.RM_COST          = rpdmodeldata.RM_COST;
                ddciInfo.FINAL_COST       = rpdmodeldata.FINAL_COST;
                ddciInfo.COST_NOTES       = rpdmodeldata.COST_NOTES;
                ddciInfo.PROCESSED_BY     = rpdmodeldata.PROCESSED_BY;
                ddciInfo.ORDER_DT         = rpdmodeldata.ORDER_DT;
                ddciInfo.PRINT            = rpdmodeldata.PRINT;
                ddciInfo.ALLOT_PART_NO    = rpdmodeldata.ALLOT_PART_NO;
                ddciInfo.PART_NO_REQ_DATE = rpdmodeldata.PART_NO_REQ_DATE;
                ddciInfo.CUST_STD_NO      = rpdmodeldata.CUST_STD_NO;

                //if (rpdmodeldata.CUST_STD_DATE_NEW.ToString().Trim() == "")
                //{
                //    ddciInfo.CUST_STD_DATE = Convert.ToDateTime(rpdmodeldata.CUST_STD_DATE_NEW.ToString());
                //    //RPDModelData.CUST_STD_DATE;
                //}
                ddciInfo.CUST_STD_DATE = rpdmodeldata.CUST_STD_DATE;


                ddciInfo.AUTOPART           = rpdmodeldata.AUTOPART;
                ddciInfo.SAFTYPART          = rpdmodeldata.SAFTYPART;
                ddciInfo.APPLICATION        = rpdmodeldata.APPLICATION;
                ddciInfo.STATUS             = rpdmodeldata.STATUS;
                ddciInfo.CUSTOMER_NEED_DT   = rpdmodeldata.CUSTOMER_NEED_DT;
                ddciInfo.MKTG_COMMITED_DT   = rpdmodeldata.MKTG_COMMITED_DT;
                ddciInfo.PPAP_LEVEL         = rpdmodeldata.PPAP_LEVEL;
                ddciInfo.DEVL_METHOD        = rpdmodeldata.DEVL_METHOD;
                ddciInfo.PPAP_FORGING       = rpdmodeldata.PPAP_FORGING.ToDecimalValue();
                ddciInfo.PPAP_SAMPLE        = rpdmodeldata.PPAP_SAMPLE.ToDecimalValue();
                ddciInfo.PACKING            = rpdmodeldata.PACKING;
                ddciInfo.NATURE_PACKING     = rpdmodeldata.NATURE_PACKING;
                ddciInfo.SPL_CHAR           = rpdmodeldata.SPL_CHAR;
                ddciInfo.OTHER_CUST_REQ     = rpdmodeldata.OTHER_CUST_REQ;
                ddciInfo.ATP_DATE           = rpdmodeldata.ATP_DATE;
                ddciInfo.SIMILAR_PART_NO    = rpdmodeldata.SIMILAR_PART_NO;
                ddciInfo.GENERAL_REMARKS    = rpdmodeldata.GENERAL_REMARKS;
                ddciInfo.MONTHLY            = rpdmodeldata.MONTHLY.ToDecimalValue();
                ddciInfo.MKTG_COMMITED_DATE = rpdmodeldata.MKTG_COMMITED_DATE;
                ddciInfo.DELETE_FLAG        = false;
                ddciInfo.UPDATED_DATE       = DateTime.Now;
                ddciInfo.UPDATED_BY         = userInformation.UserName;
                ddciInfo.COATING_CODE       = rpdmodeldata.COATING_CODE;
                ddciInfo.REALISATION        = rpdmodeldata.REALISATION;
                ddciInfo.NO_OF_PCS          = rpdmodeldata.NO_OF_PCS;

                DB.SubmitChanges();

                SaveGridData(rpdmodeldata);

                //  return SaveGridData(RPDModelData.DeepCopy<RPDModel>());

                // ChangeSet cs = DB.GetChangeSet();
                //  return  cs.Updates.Count > 0 ? true : false;
            }
            else if (ddciInfo == null)
            {
                ddciInfo = new DDCI_INFO();
                ddciInfo.CI_REFERENCE      = rpdmodeldata.CI_REFERENCE;
                ddciInfo.ENQU_RECD_ON      = rpdmodeldata.ENQU_RECD_ON;
                ddciInfo.FR_CS_DATE        = rpdmodeldata.FR_CS_DATE;
                ddciInfo.PROD_DESC         = rpdmodeldata.PROD_DESC;
                ddciInfo.CUST_CODE         = rpdmodeldata.CUST_CODE;
                ddciInfo.CUST_DWG_NO       = rpdmodeldata.CUST_DWG_NO;
                ddciInfo.CUST_DWG_NO_ISSUE = rpdmodeldata.CUST_DWG_NO_ISSUE;
                ddciInfo.EXPORT            = rpdmodeldata.EXPORT;
                ddciInfo.NUMBER_OFF        = rpdmodeldata.NUMBER_OFF;
                ddciInfo.POTENTIAL         = rpdmodeldata.POTENTIAL.ToDecimalValue();
                ddciInfo.SFL_SHARE         = rpdmodeldata.SFL_SHARE;
                ddciInfo.REMARKS           = rpdmodeldata.REMARKS;
                ddciInfo.RESPONSIBILITY    = rpdmodeldata.RESPONSIBILITY;
                ddciInfo.PENDING           = rpdmodeldata.PENDING;
                ddciInfo.FEASIBILITY       = rpdmodeldata.FEASIBILITY;
                ddciInfo.REJECT_REASON     = rpdmodeldata.REJECT_REASON;
                ddciInfo.LOC_CODE          = rpdmodeldata.LOC_CODE;
                ddciInfo.CHEESE_WT         = rpdmodeldata.CHEESE_WT;
                ddciInfo.FINISH_WT         = rpdmodeldata.FINISH_WT;
                //  ddciInfo.FINISH_CODE = RPDModelData.FINISH_CODE;
                ddciInfo.SUGGESTED_RM       = rpdmodeldata.SUGGESTED_RM;
                ddciInfo.RM_COST            = rpdmodeldata.RM_COST;
                ddciInfo.FINAL_COST         = rpdmodeldata.FINAL_COST;
                ddciInfo.COST_NOTES         = rpdmodeldata.COST_NOTES;
                ddciInfo.PROCESSED_BY       = rpdmodeldata.PROCESSED_BY;
                ddciInfo.ORDER_DT           = rpdmodeldata.ORDER_DT;
                ddciInfo.PRINT              = rpdmodeldata.PRINT;
                ddciInfo.ALLOT_PART_NO      = rpdmodeldata.ALLOT_PART_NO;
                ddciInfo.PART_NO_REQ_DATE   = rpdmodeldata.PART_NO_REQ_DATE;
                ddciInfo.CUST_STD_NO        = rpdmodeldata.CUST_STD_NO;
                ddciInfo.CUST_STD_DATE      = rpdmodeldata.CUST_STD_DATE;
                ddciInfo.AUTOPART           = rpdmodeldata.AUTOPART;
                ddciInfo.SAFTYPART          = rpdmodeldata.SAFTYPART;
                ddciInfo.APPLICATION        = rpdmodeldata.APPLICATION;
                ddciInfo.STATUS             = rpdmodeldata.STATUS;
                ddciInfo.CUSTOMER_NEED_DT   = rpdmodeldata.CUSTOMER_NEED_DT;
                ddciInfo.MKTG_COMMITED_DT   = rpdmodeldata.MKTG_COMMITED_DT;
                ddciInfo.PPAP_LEVEL         = rpdmodeldata.PPAP_LEVEL;
                ddciInfo.DEVL_METHOD        = rpdmodeldata.DEVL_METHOD;
                ddciInfo.PPAP_FORGING       = rpdmodeldata.PPAP_FORGING.ToDecimalValue();
                ddciInfo.PPAP_SAMPLE        = rpdmodeldata.PPAP_SAMPLE.ToDecimalValue();
                ddciInfo.PACKING            = rpdmodeldata.PACKING;
                ddciInfo.NATURE_PACKING     = rpdmodeldata.NATURE_PACKING;
                ddciInfo.SPL_CHAR           = rpdmodeldata.SPL_CHAR;
                ddciInfo.OTHER_CUST_REQ     = rpdmodeldata.OTHER_CUST_REQ;
                ddciInfo.ATP_DATE           = rpdmodeldata.ATP_DATE;
                ddciInfo.SIMILAR_PART_NO    = rpdmodeldata.SIMILAR_PART_NO;
                ddciInfo.GENERAL_REMARKS    = rpdmodeldata.GENERAL_REMARKS;
                ddciInfo.MONTHLY            = rpdmodeldata.MONTHLY.ToDecimalValue();
                ddciInfo.MKTG_COMMITED_DATE = rpdmodeldata.MKTG_COMMITED_DATE;
                ddciInfo.DELETE_FLAG        = false;
                ddciInfo.UPDATED_DATE       = DateTime.Now;
                ddciInfo.UPDATED_BY         = userInformation.UserName;
                ddciInfo.COATING_CODE       = rpdmodeldata.COATING_CODE;
                ddciInfo.REALISATION        = rpdmodeldata.REALISATION;
                ddciInfo.NO_OF_PCS          = rpdmodeldata.NO_OF_PCS;
                ddciInfo.ROWID              = Guid.NewGuid();
                ddciInfo.IDPK = GenerateNextNumber("DDCI_INFO", "IDPK").ToIntValue();
                DB.DDCI_INFO.InsertOnSubmit(ddciInfo);
                DB.SubmitChanges();
                ChangeSet cs = DB.GetChangeSet();
                return(cs.Inserts.Count > 0 ? true : false);
            }
            return(true);
        }
Exemple #19
0
        public bool GetRPDData(RPDModel rpdmodeldata)
        {
            try
            {
                List <DDCI_INFO> lstddciInfo = (from o in DB.DDCI_INFO.AsEnumerable()
                                                where (int)o.IDPK == (int)rpdmodeldata.IDPK && o.CI_REFERENCE == rpdmodeldata.CI_REFERENCE
                                                select o).ToList <DDCI_INFO>();

                DDCI_INFO ddciInfo = null;
                if (lstddciInfo != null && lstddciInfo.Count > 0)
                {
                    ddciInfo = lstddciInfo[0];

                    rpdmodeldata.CUST_DWG_NO   = ddciInfo.CUST_DWG_NO.ToValueAsString();
                    rpdmodeldata.PROD_DESC     = ddciInfo.PROD_DESC.ToValueAsString();
                    rpdmodeldata.CUST_STD_DATE = ddciInfo.CUST_STD_DATE;
                    rpdmodeldata.CUST_STD_NO   = ddciInfo.CUST_STD_NO.ToValueAsString();
                    rpdmodeldata.CUST_CODE     = ddciInfo.CUST_CODE;
                    DtCustDataview             = GetCustomerCode(rpdmodeldata.CUST_CODE.ToString().ToDecimalValue());
                    if (DtCustDataview != null && DtCustDataview.Count > 0)
                    {
                        rpdmodeldata.CUST_NAME = DtCustDataview.Table.Rows[0]["CUST_NAME"].ToString();
                    }
                    else
                    {
                        rpdmodeldata.CUST_NAME = "";
                    }
                    rpdmodeldata.CUST_DWG_NO_ISSUE = ddciInfo.CUST_DWG_NO_ISSUE.ToValueAsString();
                    rpdmodeldata.CUST_STD_DATE_NEW = ddciInfo.CUST_STD_DATE.ToDateAsString("DD/MM/YYYY");
                    rpdmodeldata.ATP_DATE          = ddciInfo.ATP_DATE;
                    if (string.IsNullOrEmpty(ddciInfo.EXPORT) || ((ddciInfo.EXPORT) == "0"))
                    {
                        rpdmodeldata.EXPORT = "Domestic";
                    }
                    else if ((ddciInfo.EXPORT) == "1")
                    {
                        rpdmodeldata.EXPORT = "Export";
                    }
                    else if ((ddciInfo.EXPORT) == "2")
                    {
                        rpdmodeldata.EXPORT = "Retail";
                    }
                    else if ((ddciInfo.EXPORT) == "3")
                    {
                        rpdmodeldata.EXPORT = "Wef";
                    }
                    else
                    {
                        rpdmodeldata.EXPORT = "Domestic";
                    }

                    rpdmodeldata.SIMILAR_PART_NO = ddciInfo.SIMILAR_PART_NO.ToValueAsString();
                    rpdmodeldata.GENERAL_REMARKS = ddciInfo.GENERAL_REMARKS.ToValueAsString();

                    if (ddciInfo.POTENTIAL == null)
                    {
                        rpdmodeldata.POTENTIAL = "0";
                    }
                    else
                    {
                        rpdmodeldata.POTENTIAL = ddciInfo.POTENTIAL.ToString();
                    }

                    if (ddciInfo.MONTHLY == null)
                    {
                        rpdmodeldata.MONTHLY = "0";
                    }
                    else
                    {
                        rpdmodeldata.MONTHLY = ddciInfo.MONTHLY.ToString();
                    }

                    if (string.IsNullOrEmpty(ddciInfo.APPLICATION) == false)
                    {
                        rpdmodeldata.APPLICATION = ddciInfo.APPLICATION.ToString();
                    }
                    if (string.IsNullOrEmpty(ddciInfo.AUTOPART) == false || ddciInfo.AUTOPART == null)
                    {
                        switch (ddciInfo.AUTOPART)
                        {
                        case "Y":
                            rpdmodeldata.AutoPart_Yes = true;
                            rpdmodeldata.AutoPart_No  = false;
                            break;

                        case "N":
                            rpdmodeldata.AutoPart_Yes = false;
                            rpdmodeldata.AutoPart_No  = true;
                            break;

                        default:
                            rpdmodeldata.AutoPart_Yes = true;
                            break;
                        }
                    }
                    else
                    {
                        rpdmodeldata.AutoPart_Yes = true;
                    }
                    if (string.IsNullOrEmpty(ddciInfo.SAFTYPART) == false || ddciInfo.SAFTYPART == null)
                    {
                        //RPDModelData.SAFTYPART = ddciInfo.SAFTYPART.ToString();
                        switch (ddciInfo.SAFTYPART)
                        {
                        case "Y":
                            rpdmodeldata.Safety_Yes = true;
                            rpdmodeldata.Safety_No  = false;
                            break;

                        case "N":
                            rpdmodeldata.Safety_Yes = false;
                            rpdmodeldata.Safety_No  = true;
                            break;

                        default:
                            rpdmodeldata.Safety_Yes = true;
                            break;
                        }
                    }
                    else
                    {
                        rpdmodeldata.Safety_Yes = true;
                    }

                    if (Convert.ToDecimal(ddciInfo.STATUS) == 0)
                    {
                        rpdmodeldata.Opt_Prototype  = true;
                        rpdmodeldata.Opt_PreLaunch  = false;
                        rpdmodeldata.Opt_Production = false;
                    }
                    else if (Convert.ToDecimal(ddciInfo.STATUS) == 1)
                    {
                        rpdmodeldata.Opt_Prototype  = false;
                        rpdmodeldata.Opt_PreLaunch  = true;
                        rpdmodeldata.Opt_Production = false;
                    }
                    else if (Convert.ToDecimal(ddciInfo.STATUS) == 2)
                    {
                        rpdmodeldata.Opt_Prototype  = false;
                        rpdmodeldata.Opt_PreLaunch  = false;
                        rpdmodeldata.Opt_Production = true;
                    }
                    else
                    {
                        rpdmodeldata.Opt_Prototype = true;
                    }

                    if (Convert.ToDecimal(ddciInfo.DEVL_METHOD) == 0)
                    {
                        rpdmodeldata.Opt_Devlp_Proto     = true;
                        rpdmodeldata.Opt_Devlp_Prelaunch = false;
                    }
                    else if (Convert.ToDecimal(ddciInfo.DEVL_METHOD) == 1)
                    {
                        rpdmodeldata.Opt_Devlp_Proto     = false;
                        rpdmodeldata.Opt_Devlp_Prelaunch = true;
                    }
                    else
                    {
                        rpdmodeldata.Opt_Devlp_Proto = true;
                    }


                    rpdmodeldata.CUSTOMER_NEED_DT = ddciInfo.CUSTOMER_NEED_DT;
                    rpdmodeldata.MKTG_COMMITED_DT = ddciInfo.MKTG_COMMITED_DT;

                    if (string.IsNullOrEmpty(ddciInfo.PPAP_LEVEL) || ddciInfo.PPAP_LEVEL == null)
                    {
                        rpdmodeldata.PPAP_LEVEL = "1";
                    }
                    else
                    {
                        rpdmodeldata.PPAP_LEVEL = ddciInfo.PPAP_LEVEL.ToString();
                    }

                    if (ddciInfo.PPAP_FORGING == null)
                    {
                        rpdmodeldata.PPAP_FORGING = "0";
                    }
                    else
                    {
                        rpdmodeldata.PPAP_FORGING = ddciInfo.PPAP_FORGING.ToString();
                    }

                    if (ddciInfo.PPAP_SAMPLE == null)
                    {
                        rpdmodeldata.PPAP_SAMPLE = "0";
                    }
                    else
                    {
                        rpdmodeldata.PPAP_SAMPLE = ddciInfo.PPAP_SAMPLE.ToString();
                    }


                    if (ddciInfo.PACKING != null)
                    {
                        if (ddciInfo.PACKING == 1)
                        {
                            rpdmodeldata.Opt_Special = true;
                        }
                        else
                        {
                            rpdmodeldata.Opt_Stand = true;
                        }
                    }
                    else
                    {
                        rpdmodeldata.Opt_Stand = true;
                    }


                    rpdmodeldata.PACKING        = ddciInfo.PACKING;
                    rpdmodeldata.NATURE_PACKING = ddciInfo.NATURE_PACKING;

                    if (ddciInfo.SPL_CHAR != null)
                    {
                        if (ddciInfo.SPL_CHAR == 1)
                        {
                            rpdmodeldata.Opt_Special_Yes = true;
                        }
                        else
                        {
                            rpdmodeldata.Opt_Special_No = true;
                        }
                    }
                    else
                    {
                        rpdmodeldata.Opt_Special_Yes = true;
                    }

                    rpdmodeldata.SPL_CHAR       = ddciInfo.SPL_CHAR;
                    rpdmodeldata.OTHER_CUST_REQ = ddciInfo.OTHER_CUST_REQ;
                    rpdmodeldata.IDPK           = ddciInfo.IDPK;

                    return(true);
                }
                else
                {
                    // RPDModelData = null;
                    rpdmodeldata.CUST_DWG_NO = string.Empty;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
Exemple #20
0
        public frmrptMFM(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = "MFM")
        {
            InitializeComponent();

            this.mdiChild     = mdiChild;
            vm                = new ReportMISMFMViewModel(userInformation, mdiChild, productMaster, customerInfo, customerMaster, refreshOnLoad, title);
            this.DataContext  = vm;
            mdiChild.Closing += vm.CloseMethod;
            //if (vm.CloseAction == null && mdiChild.IsNotNullOrEmpty())
            //    vm.CloseAction = new Action(() => mdiChild.Close());
        }
        public System.Data.DataSet GetAllCustomerPartNos(PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DataRowView customerMaster = null)
        {
            System.Data.DataSet dsReport = null;
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT ");
                sb.Append(" ROW_NUMBER() OVER(ORDER BY A.PART_NO) AS SNO, ");
                sb.Append("  a.PART_NO, ");
                sb.Append("  a.PART_DESC, ");
                //sb.Append("  a.SIM_TO_STD_CD, ");
                //sb.Append("  a.PRD_CLASS_CD, ");
                //sb.Append("  a.MFG_STD, ");
                //sb.Append("  a.ED_CD, ");
                //sb.Append("  a.THREAD_CD, ");
                //sb.Append("  a.DIA_CD, ");
                //sb.Append("  a.QUALITY, ");
                //sb.Append("  a.BIF_PROJ, ");
                //sb.Append("  a.BIF_FORECAST, ");
                //sb.Append("  a.FINISH_WT, ");
                //sb.Append("  a.FINISH_WT_EST, ");
                //sb.Append("  a.HEAT_TREATMENT_CD, ");
                //sb.Append("  a.HEAT_TREATMENT_DESC, ");
                //sb.Append("  a.PRD_GRP_CD, ");
                //sb.Append("  a.MACHINE_CD, ");
                //sb.Append("  a.ALLOT_DATE, ");
                //sb.Append("  a.DOC_REL_DATE, ");
                //sb.Append("  a.DOC_REL_REMARKS, ");
                //sb.Append("  a.FAMILY, ");
                //sb.Append("  a.HEAD_STYLE, ");
                //sb.Append("  a.TYPE, ");
                //sb.Append("  a.APPLICATION, ");
                //sb.Append("  a.USER_CD, ");
                //sb.Append("  a.THREAD_CLASS, ");
                //sb.Append("  a.THREAD_STD, ");
                //sb.Append("  a.PG_CATEGORY, ");
                //sb.Append("  a.NOS_PER_PACK, ");
                //sb.Append("  a.SAMP_SUBMIT_DATE, ");
                //sb.Append("  a.ALLOTTED_BY, ");
                //sb.Append("  a.PSW_ST, ");
                //sb.Append("  a.DOC_REL_TYPE, ");
                //sb.Append("  a.HOLD_ME, ");
                //sb.Append("  a.ADDL_FEATURE, ");
                //sb.Append("  a.KEYWORDS, ");
                //sb.Append("  a.CANCEL_STATUS, ");
                //sb.Append("  a.IDPK AS PRD_MAST_IDPK, ");
                //sb.Append("  a.PART_CONFIG_ID, ");
                //sb.Append("  a.LOC_CODE, ");
                //sb.Append("  C.CI_REFERENCE, ");
                //sb.Append("  C.ENQU_RECD_ON, ");
                //sb.Append("  C.FR_CS_DATE, ");
                //sb.Append("  C.PROD_DESC, ");
                //sb.Append("  C.CUST_CODE, ");
                sb.Append("  C.CUST_DWG_NO ");
                //sb.Append("  C.CUST_DWG_NO_ISSUE, ");
                //sb.Append("  C.EXPORT, ");
                //sb.Append("  C.NUMBER_OFF, ");
                //sb.Append("  C.POTENTIAL, ");
                //sb.Append("  C.SFL_SHARE, ");
                //sb.Append("  C.REMARKS, ");
                //sb.Append("  C.RESPONSIBILITY, ");
                //sb.Append("  C.PENDING, ");
                //sb.Append("  C.FEASIBILITY, ");
                //sb.Append("  C.REJECT_REASON, ");
                //sb.Append("  C.LOC_CODE, ");
                //sb.Append("  C.CHEESE_WT, ");
                //sb.Append("  C.FINISH_WT, ");
                //sb.Append("  C.FINISH_CODE, ");
                //sb.Append("  C.SUGGESTED_RM, ");
                //sb.Append("  C.RM_COST, ");
                //sb.Append("  C.FINAL_COST, ");
                //sb.Append("  C.COST_NOTES, ");
                //sb.Append("  C.PROCESSED_BY, ");
                //sb.Append("  C.ORDER_DT, ");
                //sb.Append("  C.ALLOT_PART_NO, ");
                //sb.Append("  C.PART_NO_REQ_DATE, ");
                //sb.Append("  C.CUST_STD_NO, ");
                //sb.Append("  C.CUST_STD_DATE, ");
                //sb.Append("  C.AUTOPART, ");
                //sb.Append("  C.SAFTYPART, ");
                //sb.Append("  C.APPLICATION, ");
                //sb.Append("  C.STATUS, ");
                //sb.Append("  C.CUSTOMER_NEED_DT, ");
                //sb.Append("  C.MKTG_COMMITED_DT, ");
                //sb.Append("  C.PPAP_LEVEL, ");
                //sb.Append("  C.DEVL_METHOD, ");
                //sb.Append("  C.PPAP_FORGING, ");
                //sb.Append("  C.PPAP_SAMPLE, ");
                //sb.Append("  C.PACKING, ");
                //sb.Append("  C.NATURE_PACKING, ");
                //sb.Append("  C.SPL_CHAR, ");
                //sb.Append("  C.OTHER_CUST_REQ, ");
                //sb.Append("  C.ATP_DATE, ");
                //sb.Append("  C.SIMILAR_PART_NO, ");
                //sb.Append("  C.GENERAL_REMARKS, ");
                //sb.Append("  C.MONTHLY, ");
                //sb.Append("  C.MKTG_COMMITED_DATE, ");
                //sb.Append("  C.IDPK AS CI_IDPK, ");
                //sb.Append("  C.COATING_CODE, ");
                //sb.Append("  C.REALISATION, ");
                //sb.Append("  C.NO_OF_PCS, ");
                //sb.Append("  C.ZONE_CODE, ");
                //sb.Append("  C.RM_FACTOR, ");
                //sb.Append("  C.IS_COMBINED ");
                //sb.Append("FROM prd_mast a ");
                //sb.Append("LEFT OUTER JOIN prd_ciref b ");
                //sb.Append("ON a.part_no = b.part_no ");
                //sb.Append("LEFT OUTER JOIN ddci_info c ");
                //sb.Append("ON b.ci_ref = c.ci_reference");
                //sb.Append(" where  b.CURRENT_CIREF = 1 ");
                sb.Append("FROM prd_mast a ,prd_ciref b ,ddci_info c where a.part_no = b.part_no and b.ci_ref=c.ci_reference and b.CURRENT_CIREF = 1");

                if (customerInfo.IsNotNullOrEmpty() && customerInfo.CUST_DWG_NO.ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" and RTRIM(LTRIM(cust_dwg_no)) like '" + customerInfo.CUST_DWG_NO.ToValueAsString() + "%'");
                }

                if (productMaster.IsNotNullOrEmpty() && productMaster.PART_NO.ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" and RTRIM(LTRIM(a.part_no)) like '" + productMaster.PART_NO.ToValueAsString() + "%'");
                }

                if (customerMaster.IsNotNullOrEmpty() && customerMaster["CUST_CODE"].ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" and RTRIM(LTRIM(cust_code)) = '" + customerMaster["CUST_CODE"].ToValueAsString() + "'");
                }

                sb.Append(" order by a.PART_NO");

                List <StringBuilder> sqlList = new List <StringBuilder>()
                {
                    sb
                };

                dsReport = Dal.GetDataSet(sqlList);
                if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0)
                {
                    dsReport.Tables[0].TableName = "PRD_MAST_CI";
                }

                DataTable dtCompany = new DataTable();
                dtCompany.TableName = "CompanyName";
                dtCompany.Columns.Add("Name");
                dtCompany.Columns.Add("ShortName");
                dtCompany.Columns.Add("Phone");
                dtCompany.Columns.Add("Fax");
                dtCompany.Columns.Add("Mobile");
                dtCompany.Columns.Add("EMail");
                dtCompany.Columns.Add("Title");
                dtCompany.Columns.Add("ReportTitle");
                if (dsReport.IsNotNullOrEmpty())
                {
                    dsReport.Tables.Add(dtCompany);
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }

            return(dsReport);
        }
Exemple #22
0
        public System.Data.DataSet GetAllMFM(string startDate, string endDate, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null)
        {
            System.Data.DataSet dsReport = null;
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT ROW_NUMBER() OVER(ORDER BY MFM_MAST.PART_NO) AS SNO, ");
                sb.Append("  MFM_MAST.PART_NO, ");
                sb.Append("  CAST(DOC_REL_DT_PLAN as varchar(10)) as DOC_REL_DT_PLAN, ");
                sb.Append("  CAST(DOC_REL_DT_ACTUAL as varchar(10)) as DOC_REL_DT_ACTUAL, ");
                sb.Append("  CAST(TOOLS_READY_DT_PLAN as varchar(10)) as TOOLS_READY_DT_PLAN, ");
                sb.Append("  CAST(TOOLS_READY_ACTUAL_DT as varchar(10)) as TOOLS_READY_ACTUAL_DT, ");
                sb.Append("  CAST(FORGING_PLAN_DT as varchar(10)) as FORGING_PLAN_DT, ");
                sb.Append("  CAST(FORGING_ACTUAL_DT as varchar(10)) as FORGING_ACTUAL_DT, ");
                sb.Append("  CAST(SECONDARY_PLAN_DT as varchar(10)) as SECONDARY_PLAN_DT, ");
                sb.Append("  CAST(SECONDARY_ACTUAL_DT as varchar(10)) as SECONDARY_ACTUAL_DT, ");
                sb.Append("  CAST(HEAT_TREATMENT_PLAN_DT as varchar(10)) as HEAT_TREATMENT_PLAN_DT, ");
                sb.Append("  CAST(HEAT_TREATMENT_ACTUAL as varchar(10)) as HEAT_TREATMENT_ACTUAL, ");
                sb.Append("  CAST(ISSR_PLAN_DT as varchar(10)) as ISSR_PLAN_DT, ");
                sb.Append("  CAST(ISSR_ACTUAL_DT as varchar(10)) as ISSR_ACTUAL_DT, ");
                sb.Append("  CAST(PPAP_PLAN as varchar(10)) as PPAP_PLAN, ");
                sb.Append("  CAST(PPAP_ACTUAL_DT as varchar(10)) as PPAP_ACTUAL_DT, ");
                sb.Append("  CAST(PSW_DATE as varchar(10)) as PSW_DATE, ");
                sb.Append("  SAMPLE_QTY, ");
                sb.Append("  RESP ");
                sb.Append("FROM MFM_MAST ");

                if (customerMaster.IsNotNullOrEmpty() && customerMaster.CUST_CODE.ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" , ");
                    sb.Append("  prd_mast, ");
                    sb.Append("  prd_ciref, ");
                    sb.Append("  ddci_info ");
                }
                sb.Append(" WHERE 1 = 1 ");
                sb.Append(" AND DOC_REL_DT_PLAN BETWEEN  " + "'" + startDate + "'" + "  AND  " + "'" + endDate + "'");

                if (customerMaster.IsNotNullOrEmpty() && customerMaster.CUST_CODE.ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" AND prd_ciref.part_no    = prd_mast.part_no ");
                    sb.Append(" AND mfm_mast.part_no       = prd_mast.part_no ");

                    sb.Append(" AND ddci_info.ci_reference = prd_ciref.ci_ref AND prd_ciref.CURRENT_CIREF = 1 ");
                    //sb.Append(" AND ddci_info.ci_reference = prd_ciref.ci_ref");

                    sb.Append(" AND cust_code = '" + customerMaster.CUST_CODE.ToValueAsString() + "'");
                }

                if (productMaster.IsNotNullOrEmpty() && productMaster.PART_NO.ToValueAsString().Trim().Length > 0)
                {
                    sb.Append(" and MFM_MAST.part_no like '" + productMaster.PART_NO.ToValueAsString() + "%'");
                }

                sb.Append(" order by MFM_MAST.PART_NO");

                List <StringBuilder> sqlList = new List <StringBuilder>()
                {
                    sb
                };

                dsReport = Dal.GetDataSet(sqlList);
                if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0)
                {
                    dsReport.Tables[0].TableName = "PRD_MAST_CI";
                }

                DataTable dtCompany = new DataTable();
                dtCompany.TableName = "CompanyName";
                dtCompany.Columns.Add("Name");
                dtCompany.Columns.Add("ShortName");
                dtCompany.Columns.Add("Phone");
                dtCompany.Columns.Add("Fax");
                dtCompany.Columns.Add("Mobile");
                dtCompany.Columns.Add("EMail");
                dtCompany.Columns.Add("Title");
                dtCompany.Columns.Add("ReportTitle");
                if (dsReport.IsNotNullOrEmpty())
                {
                    dsReport.Tables.Add(dtCompany);
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }

            return(dsReport);
        }
        private void SaveSubmitCommand()
        {
            if (!OldActiveEntity.IsNotNullOrEmpty())
            {
                return;
            }
            if (!NewActiveEntity.IsNotNullOrEmpty())
            {
                return;
            }

            if (!OldActiveEntity.CI_REFERENCE.IsNotNullOrEmpty())
            {
                ShowInformationMessage(PDMsg.NotEmpty("Old CI Reference Number"));
                return;
            }

            if (!NewActiveEntity.CI_REFERENCE.IsNotNullOrEmpty())
            {
                ShowInformationMessage(PDMsg.NotEmpty("New CI Reference Number"));
                return;
            }

            if (OldActiveEntity.CI_REFERENCE.Trim() == NewActiveEntity.CI_REFERENCE.Trim())
            {
                ShowInformationMessage("CI Reference Numbers should not be same");
                return;
            }

            string           message;
            List <DDCI_INFO> lstResult = null;

            if (!bll.IsValidCIReferenceNumber(OldActiveEntity, OperationMode.Edit, out message) &&
                message.IsNotNullOrEmpty() && !(message.IndexOf("already exists") >= 0))
            {
                //ShowInformationMessage(message);
                //return;

                lstResult = (from row in bll.GetEntitiesByCIReferenceNumber(OldActiveEntity)
                             select row).ToList <DDCI_INFO>();

                if (lstResult.IsNotNullOrEmpty() && lstResult.Count == 0)
                {
                    ShowInformationMessage(PDMsg.DoesNotExists("Old CI Reference"));
                    return;
                }
            }

            lstResult = (from row in bll.GetEntitiesByCIReferenceNumber(OldActiveEntity)
                         select row).ToList <DDCI_INFO>();

            if (lstResult.IsNotNullOrEmpty() && lstResult.Count == 0)
            {
                ShowInformationMessage(PDMsg.DoesNotExists("Old CI Reference"));
                return;
            }

            lstResult = (from row in bll.GetEntitiesByCIReferenceNumber(NewActiveEntity)
                         select row).ToList <DDCI_INFO>();

            if (lstResult.IsNotNullOrEmpty() && lstResult.Count > 0)
            {
                message = PDMsg.AlreadyExists("CI Reference Number");
                message = message.IndexOf("already exists") >= 0 ?
                          "CI Reference Number " + NewActiveEntity.CI_REFERENCE + " already exists.\r\nEnter/Select another CI Reference Number" :
                          message;
                ShowInformationMessage(message);
                return;
            }

            string outMessage;

            if (!bll.IsValidCIReferenceNumber(NewActiveEntity, ActionMode, out outMessage) && outMessage.IsNotNullOrEmpty())
            {
                ShowInformationMessage(outMessage);
                return;
            }

            if (OldActiveEntity.RM_COST > 9999999999.99m)
            {
                ShowInformationMessage(PDMsg.NotExceeds("Cost for 100 Pcs", "9999999999.99"));
                return;
            }

            if (OldActiveEntity.FINAL_COST > 9999999999.99m)
            {
                ShowInformationMessage(PDMsg.NotExceeds("Cost for " + OldActiveEntity.NO_OF_PCS + " Pcs", "9999999999.99"));
                return;
            }

            if (OldActiveEntity.REALISATION > 99999999.99m)
            {
                ShowInformationMessage(PDMsg.NotExceeds("Realisation", "99999999.99"));
                return;
            }

            try
            {
                //List<DDCI_INFO> lstResult = null;
                List <DDCOST_PROCESS_DATA> lstAssociationEntity = null;

                bool isExecuted = false;
                switch (ActionMode)
                {
                case OperationMode.AddNew:
                    #region Add Operation

                    foreach (DDCOST_PROCESS_DATA associationEntity in OldActiveEntity.DDCOST_PROCESS_DATA)
                    {
                        OldActiveEntity.DDCOST_PROCESS_DATA.Remove(associationEntity);
                    }

                    string   newCIReferenceNumber = NewActiveEntity.CI_REFERENCE;
                    DateTime?newENQU_RECD_ON      = NewActiveEntity.ENQU_RECD_ON;
                    string   newZONE_CODE         = NewActiveEntity.ZONE_CODE;

                    DDCI_INFO activeEntity = OldActiveEntity.DeepCopy <DDCI_INFO>();
                    activeEntity.IDPK         = -99999;
                    activeEntity.CI_REFERENCE = newCIReferenceNumber;
                    activeEntity.ENQU_RECD_ON = newENQU_RECD_ON;
                    activeEntity.ZONE_CODE    = newZONE_CODE;

                    activeEntity.CUST_DWG_NO       = null;
                    activeEntity.CUST_DWG_NO_ISSUE = null;
                    activeEntity.FR_CS_DATE        = bll.ServerDateTime();

                    string syear = newCIReferenceNumber.Substring(1, 2).ToIntValue() == 0 ?
                                   "20" + newCIReferenceNumber.Substring(1, 2) : newCIReferenceNumber.Substring(1, 2);

                    string smonth = newCIReferenceNumber.Substring(3, 2);
                    string sday   = newCIReferenceNumber.Substring(5, 2);

                    try
                    {
                        DateTime receivedOn = new DateTime(syear.ToIntValue(), smonth.ToIntValue(), sday.ToIntValue());
                        activeEntity.ENQU_RECD_ON = receivedOn;
                    }
                    catch (Exception ex)
                    {
                        throw ex.LogException();
                    }

                    foreach (DDCOST_PROCESS_DATA associationEntity in activeEntity.DDCOST_PROCESS_DATA)
                    {
                        activeEntity.DDCOST_PROCESS_DATA.Remove(associationEntity);
                    }

                    isExecuted = bll.Update <DDCI_INFO>(new List <DDCI_INFO>()
                    {
                        activeEntity
                    });

                    if (isExecuted)
                    {
                        activeEntity = (from row in bll.GetEntitiesByCIReferenceNumber(activeEntity)
                                        select row).SingleOrDefault <DDCI_INFO>();
                        if (activeEntity.IsNotNullOrEmpty())
                        {
                            lstAssociationEntity = (from row in bll.GetCostDetails(OldActiveEntity)
                                                    select new DDCOST_PROCESS_DATA()
                            {
                                CI_REFERENCE = newCIReferenceNumber,
                                SNO = Convert.ToDecimal(row.SNO),
                                OPERATION_NO = Convert.ToDecimal(row.OPERATION_NO),
                                OPERATION = row.OPERATION,
                                COST_CENT_CODE = row.COST_CENT_CODE,
                                OUTPUT = row.OUTPUT,
                                VAR_COST = row.VAR_COST,
                                FIX_COST = row.FIX_COST,
                                SPL_COST = row.SPL_COST,
                                UNIT_OF_MEASURE = row.UNIT_OF_MEASURE,
                                TOTAL_COST = row.TOTAL_COST,
                                IDPK = -99999,
                                CI_INFO_FK = activeEntity.IDPK,
                                ROWID = Guid.NewGuid(),
                                PROCESS_CODE = Convert.ToDecimal(row.PROCESS_CODE),
                            }).ToList <DDCOST_PROCESS_DATA>();
                            if (lstAssociationEntity.IsNotNullOrEmpty() && lstAssociationEntity.Count == 0)
                            {
                                ShowInformationMessage("No Process Data to Copy");
                            }
                            else
                            {
                                isExecuted = bll.Update <DDCOST_PROCESS_DATA>(lstAssociationEntity);
                            }

                            List <DDSHAPE_DETAILS> lstFinishWeightCalculation = null;
                            lstFinishWeightCalculation = (from row in bll.GetShapeDetails(OldActiveEntity)
                                                          select new DDSHAPE_DETAILS()
                            {
                                CI_REFERENCE = newCIReferenceNumber,
                                SHAPE_CODE = row.SHAPE_CODE,
                                WEIGHT_OPTION = row.WEIGHT_OPTION,
                                HEAD1 = row.HEAD1,
                                VAL1 = row.VAL1,
                                HEAD2 = row.HEAD2,
                                VAL2 = row.VAL2,
                                HEAD3 = row.HEAD3,
                                VAL3 = row.VAL3,
                                VOLUME = row.VOLUME,
                                SIGN = row.SIGN,
                                SNO = row.SNO,
                                ROWID = row.ROWID,
                                IDPK = -99999,
                                CIREF_NO_FK = activeEntity.IDPK,
                            }).ToList <DDSHAPE_DETAILS>();
                            if (lstFinishWeightCalculation.IsNotNullOrEmpty() && lstFinishWeightCalculation.Count == 0)
                            {
                                ShowInformationMessage("No Weight Calculation Data to Copy");
                            }
                            else
                            {
                                Progress.ProcessingText = PDMsg.ProgressUpdateText;
                                Progress.Start();
                                isExecuted = bll.Update <DDSHAPE_DETAILS>(lstFinishWeightCalculation);
                                Progress.End();
                            }
                            if (isExecuted)
                            {
                                ShowInformationMessage(PDMsg.SavedSuccessfully);
                                NewActiveEntity = activeEntity.DeepCopy <DDCI_INFO>();
                                NewActiveEntity.CI_REFERENCE = string.Empty;
                                NewActiveEntity.ENQU_RECD_ON = newENQU_RECD_ON;
                                NewActiveEntity.ZONE_CODE    = newZONE_CODE;
                            }
                        }
                    }
                    #endregion
                    break;

                case OperationMode.Edit:
                    //#region Update Operation
                    //lstResult = (from row in bll.DB.DDCI_INFO
                    //             where row.CUST_DWG_NO == ActiveEntity.CUST_DWG_NO
                    //             select row).ToList<DDCI_INFO>();

                    //if (lstResult.IsNotNullOrEmpty() && lstResult.Count > 1)
                    //{
                    //    ShowInformationMessage("Customer Drawing Number already exists");
                    //    return;
                    //}

                    //lstStandardNotes = (from row in StandardNotes.ToTable().AsEnumerable()
                    //                    select new DDSTD_NOTES()
                    //                    {
                    //                        SNO = Convert.ToDecimal(row.Field<string>("SNO")),
                    //                        STD_NOTES = row.Field<string>("STD_NOTES"),
                    //                        ROWID = Guid.NewGuid(),
                    //                    }
                    //    ).ToList<DDSTD_NOTES>();

                    //isExecuted = bll.Update<DDSTD_NOTES>(lstStandardNotes);

                    //foreach (DDCOST_PROCESS_DATA associationEntity in ActiveEntity.DDCOST_PROCESS_DATA)
                    //{
                    //    ActiveEntity.DDCOST_PROCESS_DATA.Remove(associationEntity);
                    //}
                    //lstAssociationEntity = (from row in CostDetails.ToTable().AsEnumerable()
                    //                        select new DDCOST_PROCESS_DATA()
                    //                        {
                    //                            CI_REFERENCE = ActiveEntity.CI_REFERENCE,
                    //                            SNO = Convert.ToDecimal(row.Field<string>("SNO")),
                    //                            OPERATION_NO = Convert.ToDecimal(row.Field<string>("OPERATION_NO")),
                    //                            OPERATION = row.Field<string>("OPERATION"),
                    //                            COST_CENT_CODE = row.Field<string>("COST_CENT_CODE"),
                    //                            OUTPUT = Convert.ToDecimal(row.Field<string>("OUTPUT")),
                    //                            VAR_COST = Convert.ToDecimal(row.Field<string>("VAR_COST")),
                    //                            FIX_COST = Convert.ToDecimal(row.Field<string>("FIX_COST")),
                    //                            SPL_COST = Convert.ToDecimal(row.Field<string>("SPL_COST")),
                    //                            UNIT_OF_MEASURE = row.Field<string>("UNIT_OF_MEASURE"),
                    //                            TOTAL_COST = Convert.ToDecimal(row.Field<string>("TOTAL_COST")),
                    //                            IDPK = Convert.ToInt32(row.Field<string>("IDPK")),
                    //                            CI_INFO_FK = ActiveEntity.IDPK,
                    //                            ROWID = row.Field<string>("ROWID").ToGuidValue(),
                    //                        }).ToList<DDCOST_PROCESS_DATA>();

                    //isExecuted = bll.Update<DDCOST_PROCESS_DATA>(lstAssociationEntity);

                    //if (isExecuted)
                    //{

                    //    isExecuted = bll.Update<DDCI_INFO>(new List<DDCI_INFO>() { ActiveEntity });
                    //    if (isExecuted)
                    //    {
                    //        ShowInformationMessage("Records saved successfully");
                    //    }
                    //}
                    //#endregion
                    break;

                case OperationMode.Delete:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
            ActionMode = OperationMode.AddNew;
            //CIReferenceDataSource = bll.GetCIReferenceNumber().ToDataTable<V_CI_REFERENCE_NUMBER>().DefaultView;
            ChangeRights();
            Reload = true;
            CloseAction();
        }
 public CIReferenceCopy(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, DDCI_INFO ActiveEntity)
 {
     InitializeComponent();
     bll = new FeasibleReportAndCostSheet(userInformation);
     this.ActiveEntity = ActiveEntity;
 }