public override void Save()
        {
            try
            {
                if (grdLister.Rows.Where(c => c.Cells["Check"].Value.ToBool()).Count() > 0)
                {
                    objMaster.GetByPrimaryKey(CurrentVehicleId);
                    objMaster.Edit();
                    CurrentAttributeValues = string.Join(",", grdLister.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).Select(c => c.Cells[COLS.Id].Value.ToStr()).ToArray <string>());


                    if (CurrentAttributeValues.ToStr().Trim().Length > 0 && CurrentAttributeValues.StartsWith(",") == false && CurrentAttributeValues.EndsWith(",") == false)
                    {
                        CurrentAttributeValues = "," + CurrentAttributeValues + ",";
                    }


                    objMaster.Current.AttributeValues = CurrentAttributeValues;
                    objMaster.Save();
                    this.Close();

                    // objMaster.Clear();
                }
                else
                {
                    ENUtils.ShowMessage("Required atleast one Vehicle Type");
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Example #2
0
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new VehicleTypeBO();

                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;
                }
            }
        }
        private void Save()
        {
            try
            {
                int orderNo = 1;



                if (lstVehicleOrder.Items[0].Value.ToInt() != AppVars.objPolicyConfiguration.DefaultVehicleTypeId.ToInt())
                {
                    ENUtils.ShowMessage("Default Vehicle should be on Top in the order");
                    return;
                }


                foreach (RadListDataItem item in lstVehicleOrder.Items)
                {
                    //    objMaster = new ZoneBO();
                    objMaster.GetByPrimaryKey(item.Value);

                    if (objMaster.Current != null)
                    {
                        objMaster.CheckDataValidation = false;
                        objMaster.Current.OrderNo     = orderNo++;

                        objMaster.Save();
                    }
                }


                General.RefreshListWithoutSelected <frmVehicleTypeList>("frmVehicleTypeList1");

                Close();

                //General.LoadZoneList();
            }
            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }