Example #1
0
        public async Task <Tuple <bool, string, FranchiseMaster> > UpdateFranchise(FranchiseMaster obj)
        {
            Tuple <bool, string, FranchiseMaster> result = null;

            try
            {
                result = await _repo.UpdateFranchise(obj);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }
Example #2
0
        public async Task <Tuple <bool, string, FranchiseMaster> > UpdateFranchise(FranchiseMaster obj)
        {
            Tuple <bool, string, FranchiseMaster> objKey = null;
            FranchiseMaster franchiseData = new FranchiseMaster();

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dcDb))
                {
                    parameters.Add("@ID", obj.ID, DbType.Int32);
                    parameters.Add("@FranchiseType", obj.FranchiseType, DbType.String);
                    parameters.Add("@PaymentReceiptPercentage", obj.PaymentReceiptPercentage, DbType.Decimal);
                    parameters.Add("@TargetJoineesPerMonth", obj.TargetJoineesPerMonth, DbType.Int32);
                    parameters.Add("@MinimumJoineesAvg", obj.MinimumJoineesAvg, DbType.Int32);
                    parameters.Add("@CreatedBy", userID, DbType.Int32);

                    var resultObj = await cxn.QueryAsync <FranchiseMaster>("dbo.Update_FranchiseMaster", parameters, commandType : CommandType.StoredProcedure);

                    franchiseData = resultObj.Single() as FranchiseMaster;

                    cxn.Close();
                }
                if (obj.ID != 0)
                {
                    objKey = Tuple.Create(true, "Franchise data updated successfully.", franchiseData);
                }
                else
                {
                    objKey = Tuple.Create(true, "Franchise data updated successfully.", franchiseData);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                objKey = Tuple.Create(false, "Oops! Franchise data update failed.Please try again.", franchiseData);
            }

            return(objKey);
        }
Example #3
0
        public async Task <Tuple <bool, string, List <UserIDNameModel>, FranchiseMaster> > GetUnderFranchiseDetails(int FranchiseTypeID)
        {
            Tuple <bool, string, List <UserIDNameModel>, FranchiseMaster> result = null;
            List <UserIDNameModel> dataModel = new List <UserIDNameModel>();
            FranchiseMaster        fmaster   = new FranchiseMaster();

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection con = new SqlConnection(_dcDb))
                {
                    //con.Open();
                    parameters.Add("@FranchiseTypeID", FranchiseTypeID, DbType.Int32);
                    //var list = await con.QueryAsync<UserIDNameModel>("[dbo].[Select_UnderFranchiseDetails]", parameters, commandType: CommandType.StoredProcedure, commandTimeout: 300);
                    //dataModel = list as List<UserIDNameModel>;
                    //con.Close();
                    using (var multi = await con.QueryMultipleAsync("[dbo].[Select_UnderFranchiseDetails]", parameters, commandType: CommandType.StoredProcedure))
                    {
                        dataModel = multi.Read <UserIDNameModel>().ToList();
                        fmaster   = multi.Read <FranchiseMaster>().SingleOrDefault();
                    }
                }

                if (dataModel != null && dataModel.Count > 0)
                {
                    result = Tuple.Create(true, "", dataModel, fmaster);
                }
                else
                {
                    result = Tuple.Create(false, AppConstants.NO_RECORDS_FOUND, dataModel, fmaster);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                result = Tuple.Create(false, "", dataModel, fmaster);
            }
            return(result);
        }
Example #4
0
        public App()
        {
            try
            {
                var wait = UserDialogs.Instance.Loading(null, null, null, true, MaskType.Black);
                wait.Show();
                exitcount = 0;
                Permissions ps = new Permissions();
                ps.CheckGpsAsync();
                IAllDataServices_data = new AllDataServices();

                InitializeComponent();
                if (Application.Current.Properties.ContainsKey("Key"))
                {
                    Task ts = Task.Run(async() => {
                        var version       = DependencyService.Get <IAppVersionProvider>();
                        var versionString = version.AppVersion;


                        JObject output = await IAllDataServices_data.GetProfile(versionString);

                        if (output != null)
                        {
                            string Success = output["Type"].ToString();
                            if (Success == "1")
                            {
                                string[] key = Base64Decode(Application.Current.Properties["Key"].ToString()).Split('-');
                                if (key[1].ToString() == "1")
                                {
                                    App.Code      = (string)output["Result"]["Franchise_Code"];
                                    App.ContectNo = (string)output["Result"]["Franchise_PrimaryMobileNo"];
                                    App.Address   = (string)output["Result"]["Franchise_PermanentAddress"] + ',' + (string)output["Result"]["City_Name"] + ',' + (string)output["Result"]["State_Name"];
                                    App.MailId    = (string)output["Result"]["Franchise_EmailId"];
                                    App.Name      = (string)output["Result"]["Franchise_OwnerName"];
                                    App.Photo     = "http://www.theshirtshop.in/TemplateContent/Admin/images/FranchiseImages/FranchisePhoto/" + (string)output["Result"]["Franchise_Photo"];
                                }
                                else
                                {
                                    App.Code      = (string)output["Result"]["Emp_Code"];
                                    App.ContectNo = (string)output["Result"]["Emp_PrimaryMobileNo"];
                                    App.Address   = (string)output["Result"]["Emp_PermanetAddress"] + ',' + (string)output["Result"]["City_Name"] + ',' + (string)output["Result"]["State_Name"];
                                    App.MailId    = (string)output["Result"]["Emp_EmailId"];
                                    App.Name      = (string)output["Result"]["Emp_FirstName"] + " " + (string)output["Result"]["Emp_LastName"];
                                    App.Photo     = "http://www.theshirtshop.in/TemplateContent/Admin/images/EmployeeImages/EmployeePhoto/" + (string)output["Result"]["Emp_Photo"];
                                }
                            }
                            else if (Success == "101")
                            {
                                var outputs = await UserDialogs.Instance.ConfirmAsync(new ConfirmConfig
                                {
                                    Message    = "Application new version available at play store you need to update new version of app.",
                                    OkText     = "Yes",
                                    CancelText = "No",
                                    Title      = "New Version"
                                });

                                if (outputs)
                                {
                                    Device.OpenUri(new Uri("https://play.google.com/store/apps/details?id=com.companyname.theshirtshopApp"));
                                    if (Application.Current.Properties.ContainsKey("Key"))
                                    {
                                        Application.Current.Properties["Key"]      = null;
                                        Application.Current.Properties["UserName"] = null;
                                        Application.Current.Properties["Password"] = null;
                                        Application.Current.Properties["OtherId"]  = null;
                                        Application.Current.Properties.Remove("Key");
                                        Application.Current.Properties.Remove("UserName");
                                        Application.Current.Properties.Remove("Password");
                                        Application.Current.Properties.Remove("OtherId");
                                    }

                                    App.Current.MainPage = new MainPage();
                                }
                                else
                                {
                                    if (Application.Current.Properties.ContainsKey("Key"))
                                    {
                                        Application.Current.Properties["Key"]      = null;
                                        Application.Current.Properties["UserName"] = null;
                                        Application.Current.Properties["Password"] = null;
                                        Application.Current.Properties["OtherId"]  = null;
                                        Application.Current.Properties.Remove("Key");
                                        Application.Current.Properties.Remove("UserName");
                                        Application.Current.Properties.Remove("Password");
                                        Application.Current.Properties.Remove("OtherId");
                                    }

                                    App.Current.MainPage = new MainPage();
                                }
                            }
                            else if (!string.IsNullOrEmpty(Success))
                            {
                                if (Application.Current.Properties.ContainsKey("Key"))
                                {
                                    Application.Current.Properties["Key"]      = null;
                                    Application.Current.Properties["UserName"] = null;
                                    Application.Current.Properties["Password"] = null;
                                    Application.Current.Properties["OtherId"]  = null;
                                    Application.Current.Properties.Remove("Key");
                                    Application.Current.Properties.Remove("UserName");
                                    Application.Current.Properties.Remove("Password");
                                    Application.Current.Properties.Remove("OtherId");
                                }
                                App.Current.MainPage = new MainPage();
                            }
                        }
                    });
                    ts.Wait();
                    if (!string.IsNullOrEmpty(Application.Current.Properties["Key"].ToString()))
                    {
                        string[] TypeId = Base64Decode(Application.Current.Properties["Key"].ToString()).Split('-');

                        if (TypeId[1].ToString() == "1")
                        {
                            MainPage = new FranchiseMaster();
                        }
                        else if (TypeId[1].ToString() == "2")
                        {
                            MainPage = new EmployeeFranchiseMaster();
                        }
                        else if (TypeId[1].ToString() == "3")
                        {
                            MainPage = new EmployeeRetailerMaster();
                        }
                        else if (TypeId[1].ToString() == "4")
                        {
                            //Both
                            MainPage = new EmployeeFranchiseWithRetailerMaster();
                        }
                        else
                        {
                            MainPage = new MainPage();
                        }
                    }
                    else
                    {
                        MainPage = new MainPage();
                    }
                }
                else
                {
                    MainPage = new MainPage();
                }
                wait.Hide();
            }
            catch (Exception ee)
            {
                Application.Current.Properties.Remove("Key");
                Application.Current.Properties.Remove("UserName");
                Application.Current.Properties.Remove("Password");
                Application.Current.Properties.Remove("OtherId");


                MainPage = new MainPage();
            }
            //MainPage = new MainPage();
        }