示例#1
0
        private bool CheckData(int id)
        {
            try
            {
                using (var context = new RubberSoftEntities())
                {
                    var query = context.spt_GetCustomer().Where(o => o.CustomerId == id).ToList();
                    if (query.Count > 0)
                    {
                        foreach (spt_GetCustomer_Result dt in query)
                        {
                            sCustomerId = dt.CustomerId;
                        }

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }
示例#2
0
        private bool GetCustomer(int id)
        {
            try
            {
                using (var context = new RubberSoftEntities())
                {
                    var query = context.spt_GetCustomer().Where(o => o.CustomerId == id).ToList();
                    if (query.Count > 0)
                    {
                        foreach (spt_GetCustomer_Result dt in query)
                        {
                            TxtLicensePlate.Text = dt.LicensePlate;
                            TxtPhone.Text        = dt.Phone;
                            TxtAddress.Text      = dt.CustomerAddress;
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }
示例#3
0
        private bool GetData(int id)
        {
            try
            {
                using (var context = new RubberSoftEntities())
                {
                    var query = context.spt_GetCustomer().Where(o => o.CustomerId == id).ToList();
                    if (query.Count > 0)
                    {
                        foreach (spt_GetCustomer_Result dt in query)
                        {
                            TxtCustomerCode.Text    = dt.CustomerCode;
                            stCustomerCode          = dt.CustomerCode;
                            TxtCustomerName.Text    = dt.CustomerName;
                            stCustomerName          = dt.CustomerName;
                            TxtLicensePlate.Text    = dt.LicensePlate;
                            TxtPhone.Text           = dt.Phone;
                            TxtCustomerAddress.Text = dt.CustomerAddress;
                            stCustomerTypeId        = dt.CustomerTypeId.Value;
                            _IsDefault = dt.IsDefault;

                            if (_IsDefault == true)
                            {
                                LkCustomerTypes.EditValue = 0;
                                LkCustomerGroup.EditValue = 0;
                                SetDefaultCustomer(true);
                            }
                            else
                            {
                                LkCustomerTypes.EditValue = dt.CustomerTypeId;
                                LkCustomerGroup.EditValue = dt.CustomerGroupId;
                                SetDefaultCustomer(false);
                            }

                            SpinNetTotal.ReadOnly = true;
                            BtnAdjust.Enabled     = true;

                            LoadCustomerPrices(id);
                            GetValueBalance(id);
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }