private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //if (grdETAKeys.Rows.Count == 0)
                //{
                //    ENUtils.ShowMessage("Required : Keys ");
                //    return;
                //}
                string key = "etakeys";
                using (TaxiDataContext db = new TaxiDataContext())
                {
                    db.ExecuteCommand("delete from mapkeys where maptype='" + key + "'");

                    int    cnt    = 10;
                    string ApiKey = string.Join("<etakeys>", grdETAKeys.Rows.Select(c => c.Cells["column1"].Value.ToStr().ToUpper()).ToArray <string>());

                    db.ExecuteCommand("insert into mapkeys (Id,MapType,APIKey) values (" + cnt + ",'" + key + "','" + ApiKey + "')");
                    //foreach (var item in grdETAKeys.Rows)
                    //{
                    //column1

                    //db.ExecuteCommand("insert into mapkeys values("+cnt+",'etakeys from mapkeys where maptype='etakeys'");


                    //}



                    //string key = db.ExecuteQuery<string>("select APIKey from mapkeys where maptype='etakeys'").FirstOrDefault().ToStr().Trim();


                    //if (key.ToStr().Trim().Length > 0)
                    //{
                    //    foreach (var item in key.ToStr().Trim().Split(new string[] { "<etakey>" }, StringSplitOptions.RemoveEmptyEntries))
                    //    {
                    //        ETAKeys.Add(item);
                    //    }
                    //}
                }
                ENUtils.ShowMessage("Key Saved successfully");
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Exemple #2
0
        private void UpdateRecord()
        {
            try
            {
                string AppType           = ddlApplicationType.Text.ToStr();
                string Error             = "";
                int?   ApplicationTypeId = null;// ddlApplicationType.SelectedValue.ToInt();
                string Link    = txtLink.Text.Trim();
                string Version = txtVersion.Text.Trim();
                if (AppType == "Android Driver App")
                {
                    ApplicationTypeId = 1;
                }
                else if (AppType == "Iphone Driver App")
                {
                    ApplicationTypeId = 2;
                }
                if (ApplicationTypeId == null)
                {
                    Error = "Required : Application Type";
                }
                if (string.IsNullOrEmpty(Link))
                {
                    if (string.IsNullOrEmpty(Error))
                    {
                        Error = "Required : App Url";
                    }
                    else
                    {
                        Error += Environment.NewLine + "Required : App Url";
                    }
                }
                if (string.IsNullOrEmpty(Version))
                {
                    if (string.IsNullOrEmpty(Error))
                    {
                        Error = "Required : App Version";
                    }
                    else
                    {
                        Error += Environment.NewLine + "Required : App Version";
                    }
                }
                if (!string.IsNullOrEmpty(Error))
                {
                    ENUtils.ShowMessage(Error);
                    return;
                }

                using (TaxiDataContext db = new TaxiDataContext())
                {
                    int I = db.ExecuteCommand("update AppsLink set Link='" + Link + "', Version = '" + Version + "' where Id= " + ApplicationTypeId + "");
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }