Example #1
0
        private void FillDesignations()
        {
            objSQLDB = new SQLDB();
            objDLDB  = new DealerInfo();
            DataTable dt = new DataTable();

            cbDesig.DataSource = null;
            try
            {
                dt = objDLDB.DesigInShanm();
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.NewRow();
                    dr["desig_name"] = "--Select--";
                    dr["desig_name"] = "--Select--";
                    dt.Rows.InsertAt(dr, 0);

                    cbDesig.DataSource    = dt;
                    cbDesig.DisplayMember = "desig_name";
                    cbDesig.ValueMember   = "DESG_ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objSQLDB = null;
                dt       = null;
            }
        }
Example #2
0
        public static List <DealerRedeemed> GetCouponByDealer(DealerInfo Dealer, DateTime FromTime, DateTime ToTime)
        {
            try
            {
                var collection = DAOManager._database.GetCollection <CouponInfo>("CouponInfo");
                var Filter     = Builders <CouponInfo> .Filter.And(
                    Builders <CouponInfo> .Filter.Gt(x => x.RedeemedDate, FromTime),
                    Builders <CouponInfo> .Filter.Lt(x => x.RedeemedDate, ToTime),
                    Builders <CouponInfo> .Filter.Eq(x => x.RedeemedByDealer, Dealer.Name));

                var RedeemedList = collection.Find(Filter).ToList();
                if (RedeemedList != null)
                {
                    for (int i = 0; i < RedeemedList.Count; i++)
                    {
                        RedeemedList[i].GiftCode = NissanCouponLibrary.Utils.DES.Decrypt(RedeemedList[i].GiftCode);
                    }

                    var Return = new List <DealerRedeemed>();
                    foreach (var tmpRedeemed in RedeemedList)
                    {
                        Return.Add(tmpRedeemed.ToDealerRedeemed());
                    }
                    return(Return);
                }
            }
            catch (Exception ex)
            {
                NissanCouponLibrary.Utils.Log.LogError("IsCouponExist", "", ex.Message);
            }

            return(new List <DealerRedeemed>());
        }
        public void DeleteDealerInfo(DealerInfo dealerInfo)
        {
            if (dealerInfo == null)
            {
                throw new ArgumentNullException(nameof(dealerInfo));
            }

            _context.DealerInfos.Remove(dealerInfo);
        }
        public void CreateDealerInfo(DealerInfo dealerInfo)
        {
            if (dealerInfo == null)
            {
                throw new ArgumentNullException(nameof(dealerInfo));
            }

            _context.DealerInfos.Add(dealerInfo);
        }
    //heal player
    private void Heal(int _value, DealerInfo _info)
    {
        Health            += _value;
        EmegencyText.color = Color.green;
        EmegencyText.text  = _info.EmegencyText;

        if (Health >= 100)
        {
            Health = 100;
        }
        UpdateHealthVisual();
    }
Example #6
0
        public void EncryptedFileConfig()
        {
            IEncyptedSimetric encripted          = new EncryptedSimetric();
            String            conectionSystime   = @"metadata=res://*/DataAccess.SystimeDb.csdl|res://*/DataAccess.SystimeDb.ssdl|res://*/DataAccess.SystimeDb.msl;provider=System.Data.SqlClient;provider connection string='data source=200.119.44.53,49190;initial catalog=Systimedb;user id=sa;password=J1u5a0n6fxe;MultipleActiveResultSets=True;'";
            String            conectionDelaerErp = @"metadata=res://*/Erps.DmsV1.DataAcces.DmsV1Db.csdl|res://*/Erps.DmsV1.DataAcces.DmsV1Db.ssdl|res://*/Erps.DmsV1.DataAcces.DmsV1Db.msl;provider=System.Data.SqlClient;provider connection string='data source=192.168.1.100,1433;initial catalog=Autostok;user id=systime;password=systime_as;MultipleActiveResultSets=True;'";
            //String conectionDelaerErp = @"metadata=res://*/Erps.DmsV1.DataAcces.DmsV1Db.csdl|res://*/Erps.DmsV1.DataAcces.DmsV1Db.ssdl|res://*/Erps.DmsV1.DataAcces.DmsV1Db.msl;provider=System.Data.SqlClient;provider connection string='data source=ASBTAPDC02;initial catalog=Autostoktempo;user id=esfera;password=esfera2015;MultipleActiveResultSets=True;'";

            String     conectionSystimeTest        = @"metadata=res://*/DataAccess.SystimeDb.csdl|res://*/DataAccess.SystimeDb.ssdl|res://*/DataAccess.SystimeDb.msl;provider=System.Data.SqlClient;provider connection string='data source=200.119.44.53,49190;initial catalog=Systimedb;user id=sa;password=J1u5a0n6fxe;MultipleActiveResultSets=True;'";
            String     conectionNotification       = @"metadata=res://*/DataAcces.NotificationDb.csdl|res://*/DataAcces.NotificationDb.ssdl|res://*/DataAcces.NotificationDb.msl;provider=System.Data.SqlClient;provider connection string='data source=200.119.44.53,49190;initial catalog=Systimedb;persist security info=True;user id=sa;password=J1u5a0n6fxe;MultipleActiveResultSets=True;'";
            String     ConectionStringSystimeTest2 = @"metadata=res://*/DataAccess.SystimeDb.csdl|res://*/DataAccess.SystimeDb.ssdl|res://*/DataAccess.SystimeDb.msl;provider=System.Data.SqlClient;provider connection string='data source=200.119.44.53,49190;initial catalog=Systimedb;user id=sa;password=J1u5a0n6fxe;MultipleActiveResultSets=True;'";
            Config     config       = new Config(false, false);
            DealerInfo mDealerInfo1 = new DealerInfo()
            {
                IdCityDealer                = encripted.EncryptString("CO", config.KeyDealer, config.IvDealer),
                IdDealer                    = encripted.EncryptString("3", config.KeyDealer, config.IvDealer),
                IdShopsErp                  = "11;9;7",
                PassWord                    = encripted.EncryptString("password", config.KeyDealer, config.IvDealer),
                TinDealer                   = encripted.EncryptString("860507710", config.KeyDealer, config.IvDealer),
                PathBaseFiles               = encripted.EncryptString("C://SysTime//Files", config.KeyDealer, config.IvDealer),
                Token                       = encripted.EncryptString("myToken", config.KeyDealer, config.IvDealer),
                IdErp                       = encripted.EncryptString("DMS", config.KeyDealer, config.IvDealer),
                DllType                     = encripted.EncryptString("DMSV1", config.KeyDealer, config.IvDealer),
                ConectionStringToSystime    = encripted.EncryptString(conectionSystime, config.KeyDealer, config.IvDealer),
                ConectionStringErp          = encripted.EncryptString(conectionDelaerErp, config.KeyDealer, config.IvDealer),
                ConectionStringSystimeTest  = encripted.EncryptString(conectionSystimeTest, config.KeyDealer, config.IvDealer),
                ConectionStringSystimeTest2 = encripted.EncryptString(ConectionStringSystimeTest2, config.KeyDealer, config.IvDealer),
                LanguageDb                  = encripted.EncryptString("es-co", config.KeyDealer, config.IvDealer),
                ConectionStringNotification = encripted.EncryptString(conectionNotification, config.KeyDealer, config.IvDealer),
                UrlWebServiceUbicar         = encripted.EncryptString("http://ubicarservices.azurewebsites.net/", config.KeyDealer, config.IvDealer),
                SaveInAzure                 = true,
                SaveInTest                  = true,
                SaveInTest2                 = true,
                UrlWcf                      = encripted.EncryptString("http://localhost:55289/api/SystimeDLLNotify/", config.KeyDealer, config.IvDealer),
                UrlWcfTest                  = encripted.EncryptString("http://localhost:55289/api/SystimeDLLNotify/", config.KeyDealer, config.IvDealer),
                NotifyWcfChangeDataBase     = true,
                UrlWebServiceUbicarTest     = encripted.EncryptString("Azure Web service Test", config.KeyDealer, config.IvDealer),
                NotifyConfig                = new List <NotifyConfig>()
                {
                    { new NotifyConfig()
                      {
                          NameNotification = "Notifcacion WorkOrders", TableName = "WorkOrders", EnventArray = new EventDataBase[] { EventDataBase.Delete, EventDataBase.Insert, EventDataBase.Update }, PropiertyChange = null
                      } },
                    { new NotifyConfig()
                      {
                          NameNotification = "Notifcacion WorkOrders", TableName = "WorkOrders", EnventArray = new EventDataBase[] { EventDataBase.Delete, EventDataBase.Insert, EventDataBase.Update }, PropiertyChange = null
                      } }
                }
            };

            String json = JsonConvert.SerializeObject(mDealerInfo1);

            String encriptSTringObject = encripted.EncryptString(json, config.KeyDealer, config.IvDealer);
        }
Example #7
0
 public int GetAmountWithDesignation(int total, DealerInfo item)
 {
     if (item.Designation == "C" && item.SellAmount >= 20000)
     {
         int amount = (int)((total * 1.5) / 100);
         return(amount);
     }
     else if (item.Designation == "D" && item.SellAmount >= 30000)
     {
         int amount = (int)((total * 0.5) / 100);
         return(amount);
     }
     else if (item.Designation == "E" && item.SellAmount >= 70000)
     {
         int amount = (int)((total * 6.5) / 100);
         return(amount);
     }
     else if (item.Designation == "F")
     {
         int amount = (int)((total * 1.5) / 100);
         return(amount);
     }
     else if (item.Designation == "G")
     {
         int amount = (int)((total * 1.5) / 100);
         return(amount);
     }
     else if (item.Designation == "H")
     {
         int amount = (int)((total * 2.5) / 100);
         return(amount);
     }
     else if (item.Designation == "I")
     {
         int amount = (int)((total * 1.0) / 100);
         return(amount);
     }
     else if (item.Designation == "J")
     {
         int amount = (int)((total * 0.5) / 100);
         return(amount);
     }
     else if (item.Designation == "K")
     {
         int amount = (int)((total * 1.0) / 100);
         return(amount);
     }
     else
     {
         return(0);
     }
 }
Example #8
0
        public IActionResult Create()
        {
            Dealer dealer       = new Dealer();
            var    name         = Request.Form["name"];
            var    associateOf  = Request.Form["associateOf"].ToString();
            var    companyId    = Request.Form["companyId"];
            var    dealerTypeId = Request.Form["dealerTypeId"];
            var    thanaId      = Request.Form["thanaId"];

            dealer.Name         = name;
            dealer.CompanyId    = Convert.ToInt32(companyId);
            dealer.ThanaId      = Convert.ToInt32(thanaId);
            dealer.DealerTypeId = Convert.ToInt32(dealerTypeId);
            if (dealer.DealerTypeId == 1)
            {
                dealer.IsSIDC = 1;
            }
            else if (dealer.DealerTypeId == 2)
            {
                dealer.IsAMC = 1;
            }
            else
            {
                dealer.IsBMC = 1;
            }
            db.Dealers.Add(dealer);
            db.SaveChanges();
            int dealerId = dealer.Id;

            DealerInfo dealerInfo = new DealerInfo();

            dealerInfo.DealerCode = GetDealerCode(dealer.DealerTypeId, dealerId);
            dealerInfo.DealerId   = dealerId;
            if (associateOf == "")
            {
                dealerInfo.AssociateOf = "Company";
            }
            else
            {
                dealerInfo.AssociateOf = associateOf;
            }
            dealerInfo.Designation = "A";
            db.DealerInfos.Add(dealerInfo);
            db.SaveChanges();



            return(Redirect("Index"));
        }
    //dealdamage to player
    private void TakeDamage(int _value, DealerInfo _info)
    {
        Health            -= _value;
        EmegencyText.color = Color.red;

        EmegencyText.text = _info.EmegencyText;
        UpdateHealthVisual();
        if (Health < 0)
        {
            //dead
            Level++;
            dead();
        }
        //Debug.Log(_info.EmegencyText + Health);
    }
Example #10
0
 public static List <DealerRedeemed> GetDealerRedeemedList(DealerInfo dealer, string from, string to)
 {
     try
     {
         var client  = new RestClient(BaseUrl);
         var request = new RestRequest(string.Format("/GetDealerRedeemedList/{0}/{1}/{2}", ApiKey, from, to), Method.POST);
         request.RequestFormat = DataFormat.Json;
         request.AddJsonBody(dealer);
         var response = client.Execute(request);
         return(JsonConvert.DeserializeObject <List <DealerRedeemed> >(response.Content));
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
         return(null);
     }
 }
Example #11
0
        /// <summary>
        /// Get Dealer
        /// </summary>
        /// <param name="Uri"></param>
        /// <returns></returns>
        static public int GetDealer(string Uri)
        {
            //Console.WriteLine("Start GetDealer: " + Uri);
            string     data          = HttpUtils.GetData(Uri);
            DealerInfo DealerInfoObj = JsonConvert.DeserializeObject <DealerInfo>(data);

            DealerAnswer DealerAnswerObj = new DealerAnswer();

            DealerAnswerObj.name     = DealerInfoObj.name;
            DealerAnswerObj.dealerId = DealerInfoObj.dealerId;
            DealerAnswerObj.vehicles = new List <VehicleAnswer>();

            dealerDetailDic.Add(DealerInfoObj.dealerId, DealerAnswerObj);

            //Console.WriteLine("End of GetDealer {0} \n\n{1}", Uri, data);
            return(1);
        }
Example #12
0
        private void FillVillage(string sState, string sDistrict, string sMandal)
        {
            DataTable dt = null;

            objData = new SQLDB();
            objDATA = new DealerInfo();
            clbVillage.Items.Clear();
            //strChkDistrict = "";
            string strCmd = "";

            try
            {
                if (sState.Length > 0 && sDistrict.Length > 0 && sMandal.Length > 0)
                {
                    sState    = sState.Remove(sState.Length - 1);
                    sDistrict = sDistrict.Remove(sDistrict.Length - 1);
                    sMandal   = sMandal.Remove(sMandal.Length - 1);
                    strCmd    = "SELECT DISTINCT DAMH_FIRM_HEAD_VILL_OR_TOWN Village FROM DL_APPL_MASTER_HEAD WHERE  DAMH_FIRM_HEAD_MANDAL IN (" + sMandal + ")";

                    //dt = objDATA.GetDlVillages(sState, sDistrict, sMandal).Tables[0];
                    dt = objData.ExecuteDataSet(strCmd).Tables[0];
                }
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = item["Village"].ToString();
                        oclBox.Text = item["Village"].ToString();
                        clbVillage.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objData = null;
                dt      = null;
            }
        }
Example #13
0
        private void FillDistricts(string sState)
        {
            DataTable dt = null;

            objData = new SQLDB();
            objDATA = new DealerInfo();
            clbDistrict.Items.Clear();
            strChkDistrict = "";
            string strCmd = "";

            try
            {
                if (sState.Length > 0)
                {
                    sState = sState.Remove(sState.Length - 1);
                    strCmd = " SELECT DISTINCT DAMH_FIRM_HEAD_DISTRICT District FROM DL_APPL_MASTER_HEAD WHERE  DAMH_FIRM_HEAD_STATE IN (SELECT sm_state FROM state_mas WHERE sm_state_code in (" + sState + "))";
                    //dt = objDATA.GetDlVillages(sState, string.Empty, string.Empty).Tables[0];
                    dt = objData.ExecuteDataSet(strCmd).Tables[0];
                }
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = item["District"].ToString();
                        oclBox.Text = item["District"].ToString();
                        clbDistrict.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objData = null;
                dt      = null;
            }
        }
Example #14
0
        private void GetSONames()
        {
            objDLDB = new DealerInfo();
            DataTable dt = new DataTable();
            DataSet   ds = new DataSet();

            ds = null;
            cbEcode.DataSource = null;
            try
            {
                string strSRName = txtEcodeSearch.Text.ToString();
                //cbGCEcode.Items.Clear();
                if (cbDesig.SelectedIndex > 0)
                {
                    dt = objDLDB.SOEcodeSearchByDesig_Get(CommonData.CompanyCode, CommonData.BranchCode, CommonData.DocMonth, cbDesig.SelectedValue.ToString(), strSRName);
                }

                if (dt.Rows.Count > 0)
                {
                    cbEcode.DataSource    = dt;
                    cbEcode.DisplayMember = "EmpName";
                    cbEcode.ValueMember   = "ECODE";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (cbEcode.SelectedIndex > -1)
                {
                    cbEcode.SelectedIndex = 0;
                    strECode = ((System.Data.DataRowView)(cbEcode.SelectedItem)).Row.ItemArray[0].ToString();
                }
                objDLDB        = null;
                Cursor.Current = Cursors.Default;
            }
        }
Example #15
0
            public async Task <Unit> Handle(Dealer request, CancellationToken cancellationToken)
            {
                var dealer = new DealerInfo
                {
                    Id       = request.Id,
                    Name     = request.Name,
                    Address1 = request.Address1,
                    Address2 = request.Address2,
                    City     = request.City,
                    PostCode = request.PostCode
                };

                _context.DealerInfos.Add(dealer);

                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(Unit.Value);
                }

                throw new Exception("Problem saving changes");
            }
Example #16
0
        public int CreateDealership(DealerInfo dealership)
        {
            int       result  = 0;
            DbCommand command = db.GetStoredProcCommand("Core.CreateDealership");

            try
            {
                db.AddInParameter(command, "@DealerShipName", SqlDbType.VarChar, dealership.DealerShipName);
                db.AddInParameter(command, "@LegalName", SqlDbType.VarChar, dealership.LegalName);
                db.AddInParameter(command, "@Address", SqlDbType.VarChar, dealership.Address);
                db.AddInParameter(command, "@Zip", SqlDbType.VarChar, dealership.Zip);
                db.AddInParameter(command, "@StateId", SqlDbType.VarChar, dealership.StateID);
                db.AddInParameter(command, "@City", SqlDbType.VarChar, dealership.City);

                db.AddInParameter(command, "@Phone", SqlDbType.VarChar, dealership.Phone);
                db.AddInParameter(command, "@Email", SqlDbType.VarChar, dealership.Email);
                db.AddInParameter(command, "@Fax", SqlDbType.VarChar, dealership.Fax);
                db.AddInParameter(command, "@CompanyId", SqlDbType.Int, dealership.CompanyId);
                db.AddInParameter(command, "@GroupId", SqlDbType.Int, dealership.GroupID);
                db.AddInParameter(command, "@IsActive", SqlDbType.Bit, dealership.IsActive);

                db.AddInParameter(command, "@Website", SqlDbType.VarChar, dealership.Website);
                db.AddInParameter(command, "@DealerFinanceLicense", SqlDbType.VarChar, dealership.DealerFinanceLicense);
                db.AddInParameter(command, "@ServiceScheduleUrl", SqlDbType.VarChar, dealership.ServiceSheduleUrl);
                db.AddInParameter(command, "@DefaultUsers", SqlDbType.Int, dealership.DefaultUsers);
                db.AddInParameter(command, "@TimeZone", SqlDbType.VarChar, dealership.TimeZone);
                db.AddInParameter(command, "@DealerInfo", SqlDbType.VarChar, dealership.DealerOtherInfo);

                result = db.ExecuteNonQuery(command);
            }
            catch (Exception ex)
            {
                new Log().LogError(ex.Message, ex.StackTrace);
            }
            return(result);
        }
Example #17
0
        private void FillStates()
        {
            DataTable dt = null;

            objData = new SQLDB();
            objDATA = new DealerInfo();
            string strCmd = "";

            clbState.Items.Clear();
            strChkState    = "";
            strChkDistrict = "";
            try
            {
                dt = objDATA.GetDlStates_Proc().Tables[0];
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = item["code"].ToString();
                        oclBox.Text = item["state"].ToString();
                        clbState.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objData = null;
                dt      = null;
            }
        }
Example #18
0
        public ReturnInfo UploadCouponData(string ApiKey, Stream Data)
        {
            try
            {
                if (ApiKey != ServerConfig.ServicesApiKey)
                {
                    return new ReturnInfo
                           {
                               ReturnCode   = 1,
                               ReturnString = string.Format("API không đúng")
                           }
                }
                ;

                var NewCounpon = NissanCouponLibrary.Utils.Rest.GetObjectFromStream <List <CouponInfo> >(Data);
                if (NewCounpon.Count > 0)
                {
                    // Check dealer, campaign and create gift code
                    foreach (var tmpCounpon in NewCounpon)
                    {
                        // Create gift code
                        DealerInfo tmpDealer = DataBase.DealerDAO.GetDealer(Name: tmpCounpon.DealerName);
                        if (tmpDealer == null)
                        {
                            return new ReturnInfo {
                                       ReturnCode = 100, ReturnString = string.Format("Đại lý '{0}' không tồn tại trên hệ thống.", tmpCounpon.DealerName)
                            }
                        }
                        ;

                        if (tmpDealer.IsValid())
                        {
                            tmpCounpon.CreateGiftCode(tmpDealer);
                        }
                        else
                        {
                            return(new ReturnInfo {
                                ReturnCode = 101, ReturnString = string.Format("Thông tin đại lý không hợp lệ : '{0}'", tmpCounpon.DealerName)
                            });
                        }

                        var tmpReturn = tmpCounpon.IsValid();
                        if (tmpReturn.ReturnCode != 0)
                        {
                            return(tmpReturn);
                        }
                    }

                    // Check coupon exist or not
                    var CheckCouponResult = DataBase.CouponDAO.IsCouponExist(NewCounpon);

                    if (CheckCouponResult.ReturnCode != 0)
                    {
                        return(CheckCouponResult);
                    }

                    // If all of things are ok, update to DB
                    foreach (var tmpCounpon in NewCounpon)
                    {
                        DataBase.CouponDAO.UpdateCounpon(tmpCounpon);
                    }

                    CouponManager.InsertNewCoupon(NewCounpon);
                }

                return(new ReturnInfo
                {
                    ReturnCode = 0,
                    ReturnString = string.Format("Upload dữ liệu thành công")
                });
            }
            catch (Exception ex)
            {
                NissanCouponLibrary.Utils.Log.LogError("UploadCouponData", "", ex.Message);
            }

            return(new ReturnInfo
            {
                ReturnCode = 255,
                ReturnString = "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu"
            });
        }
 public void UpdateDealerInfo(DealerInfo dealerInfo)
 {
     //Nothing
 }
 public void DeleteDealerInfo(DealerInfo dealerInfo)
 {
     throw new System.NotImplementedException();
 }
 public void DealDamage(int v, DealerInfo _info)
 {
     HealthSyatem.Instance.DealDamage(v, _info);
 }
Example #22
0
        public IActionResult CreateExistingMember()
        {
            var dealerId     = Request.Form["dId"];
            var name         = Request.Form["name"];
            var companyId    = Request.Form["cId"];
            var dealerTypeId = Convert.ToInt32(Request.Form["dTypeId"]);
            var thanaId      = Request.Form["tId"];
            var associateOf  = Request.Form["associatorOf"];

            var data = db.Dealers.Find(Convert.ToInt32(dealerId));

            if (dealerTypeId == 1)
            {
                if (data.IsSIDC == 1)
                {
                    TempData["message"] = "This user is Already Registered as SIDC member";
                    return(Redirect("Index"));
                }
                else
                {
                    data.IsSIDC = 1;
                }
            }
            else if (dealerTypeId == 2)
            {
                if (data.IsAMC == 1)
                {
                    TempData["message"] = "This user is Already Registered as AMC member";
                    return(Redirect("Index"));
                }
                else
                {
                    data.IsAMC = 1;
                }
            }
            else
            {
                if (data.IsBMC == 1)
                {
                    TempData["message"] = "This user is Already Registered as BMC member";
                    return(Redirect("Index"));
                }
                else
                {
                    data.IsBMC = 1;
                }
            }



            DealerInfo dealerInfo = new DealerInfo();

            dealerInfo.DealerCode = GetDealerCode(dealerTypeId, Convert.ToInt32(dealerId));
            dealerInfo.DealerId   = Convert.ToInt32(dealerId);
            if (associateOf == "")
            {
                dealerInfo.AssociateOf = "Company";
            }
            else
            {
                dealerInfo.AssociateOf = associateOf;
            }
            dealerInfo.Designation = "A";
            db.Dealers.Update(data);
            db.DealerInfos.Add(dealerInfo);
            db.SaveChanges();
            return(Redirect("Index"));
        }