Example #1
0
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                //  objMaster = new Gen_EscortBO();
                this.SetProperties((INavigation)objMaster);


                try
                {
                    objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt());
                    objMaster.Delete(objMaster.Current);
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }
        public override void Save()
        {
            try
            {
                if (objMaster.PrimaryKeyValue == null)
                {
                    objMaster.New();
                }
                else
                {
                    objMaster.Edit();
                    objMaster.Current.EditBy  = AppVars.LoginObj.LuserId.ToInt();
                    objMaster.Current.EditLog = AppVars.LoginObj.UserName.ToStr();
                    objMaster.Current.EditOn  = DateTime.Now.ToDateTime();
                }



                objMaster.Current.EscortName   = txtEscortName.Text.Trim();
                objMaster.Current.EmailAddress = txtEmail.Text.Trim();
                objMaster.Current.TelephoneNo  = txtTelephoneNo.Text.Trim();
                objMaster.Current.MobileNo     = txtMobileNo.Text.Trim();
                objMaster.Current.AddressLine1 = txtAddress1.Text.Trim();
                objMaster.Current.AddBy        = AppVars.LoginObj.LuserId.ToInt();
                objMaster.Current.AddLog       = AppVars.LoginObj.UserName.ToStr();
                objMaster.Current.AddOn        = DateTime.Now.ToDateTime();
                objMaster.Save();
                General.RefreshListWithoutSelected <frmEscortList>("frmEscortList1");
                this.Close();
                //OnNew();

                //General.RefreshListWithoutSelected<frmCustomersList>("frmCustomersList1");
                // General.RefreshListWithoutSelected<frmBlackCustomersList>("frmBlackCustomersList1");
            }
            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }