Пример #1
0
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new CustomerBO();

                try
                {
                    objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt());
                    objMaster.Delete(objMaster.Current);


                    PopulateData();
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }
        private void btnExcludedDrivers_Click(object sender, EventArgs e)
        {
            try
            {
                if (objMaster != null)
                {
                    if (objMaster.Current.Id != 0)
                    {
                        string Ids = objMaster.Current.ExcludedDriverIds.ToStr();
                        frmCustomerExcDriversList frm = new frmCustomerExcDriversList(Ids, objMaster.Current.Id);
                        frm.ShowDialog();


                        this.excludedDriverIds = frm.input_Ids;
                        this.excludedDriverNos = frm.input_values;
                        frm.Dispose();


                        objMaster.GetByPrimaryKey(objMaster.Current.Id);

                        DisplayRecord();
                    }
                }
            }
            catch
            {
            }
        }
        private int?GetCustomerId()
        {
            CustomerBO objCustomer   = new CustomerBO();
            int?       rtnCustomerId = null;

            try
            {
                if (objMaster.PrimaryKeyValue == null)
                {
                    objCustomer.New();
                    objCustomer.Current.Name            = txtCustomerName.Text.Trim();
                    objCustomer.Current.MobileNo        = txtMobileNo.Text.Trim();
                    objCustomer.Current.TelephoneNo     = txtTelephoneNo.Text.Trim();
                    objCustomer.Current.Address1        = txtAddress1.Text.Trim();
                    objCustomer.Current.Email           = txtEmail.Text.Trim();
                    objCustomer.Current.BlackList       = false;
                    objCustomer.Current.BlackListResion = string.Empty;
                    objCustomer.Current.DoorNo          = txtDoorNo.Text.Trim();
                    objCustomer.Current.TotalCalls      = 0;
                    objCustomer.Current.AddOn           = DateTime.Now;

                    objCustomer.CheckDataValidation = false;
                    objCustomer.Save();
                }
                else
                {
                    objCustomer.GetByPrimaryKey(objMaster.Current.CustomerId);
                    objCustomer.Edit();
                    objCustomer.Current.Name            = txtCustomerName.Text.Trim();
                    objCustomer.Current.MobileNo        = txtMobileNo.Text.Trim();
                    objCustomer.Current.TelephoneNo     = txtTelephoneNo.Text.Trim();
                    objCustomer.Current.Address1        = txtAddress1.Text.Trim();
                    objCustomer.Current.Email           = txtEmail.Text.Trim();
                    objCustomer.Current.BlackList       = false;
                    objCustomer.Current.BlackListResion = string.Empty;
                    objCustomer.Current.DoorNo          = txtDoorNo.Text.Trim();
                    objCustomer.Current.TotalCalls      = 0;
                    objCustomer.Current.AddOn           = DateTime.Now;

                    objCustomer.CheckDataValidation = false;
                    objCustomer.Save();
                }

                rtnCustomerId = objMaster.PrimaryKeyValue == null?objCustomer.PrimaryKeyValue.ToIntorNull() : objMaster.Current.CustomerId;
            }
            catch
            {
            }



            return(rtnCustomerId);
        }