public static string InsertStore(string userid, string longitude, string latitude, string storeName, string phone, string street_number, string route, string city, string state, string postal_code, string country, string price, string website, string description) { try { if (string.IsNullOrEmpty(longitude) || string.IsNullOrEmpty(latitude) || string.IsNullOrEmpty(street_number) || string.IsNullOrEmpty(route) || string.IsNullOrEmpty(city) || string.IsNullOrEmpty(state) || string.IsNullOrEmpty(postal_code) || string.IsNullOrEmpty(country)) { return Strings.StoreAlert_Location; } if (string.IsNullOrEmpty(storeName) || string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(price)) { return Strings.StoreAlert_Info; } LOCATION location = mydb.LOCATIONs.SingleOrDefault(l => l.LATITUDE == Convert.ToDouble(latitude) && l.LONGITUDE == Convert.ToDouble(longitude)); if (location == null) { location = new LOCATION() { LONGITUDE = Convert.ToDouble(longitude), LATITUDE = Convert.ToDouble(latitude) }; mydb.LOCATIONs.InsertOnSubmit(location); } ADDRESS address = mydb.ADDRESSes.SingleOrDefault(a => a.ADDRESS_LINE1 == street_number + " " + route && a.CITY == city && a.STATE_PROVINCE_REGION == state && a.POSTAL_CODE == postal_code && a.COUNTRY == country); if (address == null) { address = new ADDRESS() { ADDRESS_LINE1 = street_number + " " + route, CITY = city, STATE_PROVINCE_REGION = state, POSTAL_CODE = postal_code, COUNTRY = country }; mydb.ADDRESSes.InsertOnSubmit(address); } STORE store = new STORE() { NAME = storeName, DESCRIPTION = description, PHONE = phone, WEBSITE = website, OWNER = userid, PRICE_LEVEL = Convert.ToInt32(price) }; store.LOCATION = location; store.ADDRESS = address; mydb.SubmitChanges(); return Strings.StoreAlert_Success; } catch (Exception e) { return e.Message; } }
public ActionResult GetDepo() { string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; string FirmaID = Session["FirmaID"].ToString(); List <STORE> yonetim = new List <STORE>(); string sorg = @" Select Kodu,ID,DepoAdi,Varsayilan,Durumu,EkBilgiler from STORE where FirmaID =" + FirmaID; using (SqlConnection con = new SqlConnection(strcon)) { con.Open(); using (SqlCommand dekontgetir = new SqlCommand(sorg, con)) { using (SqlDataReader dr = dekontgetir.ExecuteReader()) { while (dr.Read()) { STORE yt = new STORE(); yt.Kodu = dr["Kodu"].ToString(); yt.DepoAdi = dr["DepoAdi"].ToString(); yt.Varsayilan = dr["Varsayilan"].ToString(); yt.Durumu = dr["Durumu"].ToString(); yt.ID = Convert.ToInt32(dr["ID"].ToString()); yt.EkBilgiler = dr["EkBilgiler"].ToString(); yonetim.Add(yt); } } } } return(Json(new { data = yonetim.ToList() }, JsonRequestBehavior.AllowGet)); }
static int number_distinct_items(STORE which) { throw new NotImplementedException(); /*Store s = Misc.stores[(int)which]; * u32b *kinds = mem_zalloc(sizeof(u32b) * s.table_num); * u32b kind; * int number_kinds = 0; * * // Loop over available stock entries, counting unique kinds * for (int i = 0; i < s.table_num; i++) * { * unsigned int j; * * kind = s.table[i].kidx; * // Loop over existing found kinds, and skip out early if it's * // been seen already * for (j = 0; j < i; j++) * { * if (kinds[j] == kind) * break; * } * // If we've run off the end of the loop, we've not seen it before, * // so count it * if (j == i) { * kinds[j] = kind; * number_kinds++; * } * } * return number_kinds;*/ }
static int number_distinct_items(STORE which) { throw new NotImplementedException(); /*Store s = Misc.stores[(int)which]; u32b *kinds = mem_zalloc(sizeof(u32b) * s.table_num); u32b kind; int number_kinds = 0; // Loop over available stock entries, counting unique kinds for (int i = 0; i < s.table_num; i++) { unsigned int j; kind = s.table[i].kidx; // Loop over existing found kinds, and skip out early if it's // been seen already for (j = 0; j < i; j++) { if (kinds[j] == kind) break; } // If we've run off the end of the loop, we've not seen it before, // so count it if (j == i) { kinds[j] = kind; number_kinds++; } } return number_kinds;*/ }
public bool UpdateSTORE(STORE sTORE) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("AbiMatuEnterprise_UpdateSTORE", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@STOREID", SqlDbType.Int).Value = sTORE.STOREID; cmd.Parameters.Add("@STORENAME", SqlDbType.VarChar).Value = sTORE.STORENAME; cmd.Parameters.Add("@COMPANYNAME", SqlDbType.VarChar).Value = sTORE.COMPANYNAME; cmd.Parameters.Add("@ADDRESS", SqlDbType.VarChar).Value = sTORE.ADDRESS; cmd.Parameters.Add("@CITY", SqlDbType.VarChar).Value = sTORE.CITY; cmd.Parameters.Add("@STATE", SqlDbType.VarChar).Value = sTORE.STATE; cmd.Parameters.Add("@ZIP", SqlDbType.VarChar).Value = sTORE.ZIP; cmd.Parameters.Add("@PHONE", SqlDbType.VarChar).Value = sTORE.PHONE; cmd.Parameters.Add("@ACCOUNTNO", SqlDbType.VarChar).Value = sTORE.ACCOUNTNO; cmd.Parameters.Add("@ROUTINGNO", SqlDbType.VarChar).Value = sTORE.ROUTINGNO; cmd.Parameters.Add("@SSN", SqlDbType.VarChar).Value = sTORE.SSN; cmd.Parameters.Add("@FTPSERVER", SqlDbType.VarChar).Value = sTORE.FTPSERVER; cmd.Parameters.Add("@CREATEDBY", SqlDbType.Int).Value = sTORE.CREATEDBY; cmd.Parameters.Add("@CREATEDON", SqlDbType.DateTime).Value = sTORE.CREATEDON; cmd.Parameters.Add("@UPDATEDBY", SqlDbType.Int).Value = sTORE.UPDATEDBY; cmd.Parameters.Add("@UPDATEDON", SqlDbType.DateTime).Value = sTORE.UPDATEDON; connection.Open(); int result = cmd.ExecuteNonQuery(); return(result == 1); } }
public STORE GetSTOREFromReader(IDataReader reader) { try { STORE sTORE = new STORE ( (int)reader["STOREID"], reader["STORENAME"].ToString(), reader["COMPANYNAME"].ToString(), reader["ADDRESS"].ToString(), reader["CITY"].ToString(), reader["STATE"].ToString(), reader["ZIP"].ToString(), reader["PHONE"].ToString(), reader["ACCOUNTNO"].ToString(), reader["ROUTINGNO"].ToString(), reader["SSN"].ToString(), reader["FTPSERVER"].ToString(), (int)reader["CREATEDBY"], (DateTime)reader["CREATEDON"], (int)reader["UPDATEDBY"], (DateTime)reader["UPDATEDON"] ); return(sTORE); } catch (Exception ex) { return(null); } }
public ActionResult DepoBilgi(int id) { using (sayazilimEntities db = new sayazilimEntities()) { STORE emp = db.STORE.Where(x => x.ID == id).FirstOrDefault <STORE>(); return(Json(new { success = true, data = emp }, JsonRequestBehavior.AllowGet)); } }
public static STORE GetSTOREByID(int id) { STORE sTORE = new STORE(); SqlSTOREProvider sqlSTOREProvider = new SqlSTOREProvider(); sTORE = sqlSTOREProvider.GetSTOREByID(id); return(sTORE); }
public List <STORE> GetALL(STORE item) { using (var ctx = new SPWEntities()) { var list = ctx.STORE.Where(x => x.STORE_CODE.Contains(item.STORE_CODE)).ToList(); return(list); } }
public JsonResult YeniDepo(STORE dk) { STORE car = null; string Message = "Kayıt Eklendi"; int sonuc = 1; var result = new { sonuc = sonuc, Message = Message }; int firmaid = Convert.ToInt32(Session["FirmaID"].ToString()); if (dk.ID == -1) { car = new STORE(); car = dk; if (dk.Varsayilan == null || dk.Varsayilan == "") { car.Varsayilan = "Evet"; } int firmaidsrg = Convert.ToInt32(Session["FirmaID"].ToString()); var depolist = db.STORE.Where(x => x.FirmaID == firmaidsrg && x.Kodu == car.Kodu).ToList(); if (depolist.Count == 0) { car.FirmaID = Convert.ToInt16(Session["FirmaID"].ToString()); car.KayitT = DateTime.Now.ToString("dd.MM.yyyy"); car.DegT = DateTime.Now.ToString("dd.MM.yyyy"); car.Merkez = false; string firmaid2 = Session["FirmaID"].ToString(); string company_code = "SA01" + firmaid2.PadLeft(3, '0'); car.Company_Code = company_code; db.STORE.Add(car); db.SaveChanges(); } else { Message = "Aynı Depo Kodu İle Kayıt Eklenemez."; sonuc = 0; } } else { car = db.STORE.Where(x => x.ID == dk.ID).FirstOrDefault <STORE>(); car.Adres = dk.Adres; car.DepoAdi = dk.DepoAdi; car.Kodu = dk.Kodu; car.DegT = DateTime.Now.ToString("dd.MM.yyyy"); car.EkBilgiler = dk.EkBilgiler; car.Durumu = dk.Durumu; db.SaveChanges(); Message = "Kayıt Güncellendi"; } result = new { sonuc = 1, Message = Message }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public StoreDataModel(STORE store) { Id = store.ID; LocalizationId = store.LOCALIZATIONID; Name = store.NAME; Description = store.DESCRIPTION; PhoneNumber = store.PHONENUMBER; Email = store.EMAIL; WebSite = store.WEBSITE; Localizaton = store.LOCALIZATION.COUNTRY + " " + store.LOCALIZATION.CITY + " " + store.LOCALIZATION.STREET + " " + store.LOCALIZATION.NUMBER; }
private void fromStore_Click(object sender, EventArgs e) { long IdStoreTo = 0; // нажимаем на выбор склада "Откуда" if (this.pluginBox1.RowItem.Id == (long)0) { return; } ///Заполняем содержимое таблицы ниже foreach (object itemChecked in this.chStore.CheckedItems) { STORE item = (STORE)itemChecked; IdStoreTo = item.ID_STORE; LogTrace("Нашли склад " + item.NAME); // отладка break; #region кусок из заполнения документа //STORE item = (STORE)this.chStore.Items[i]; /*MOVEMENT mOVEMENT = new MOVEMENT() * { * MNEMOCODE = DOCUMENT_DALC.GetDocumentNumber((long)8), * DOCUMENT_STATE = (new DocumentState((EDocumentState)((long)1))).Mnemocode, * ID_STORE_FROM = this.pluginBox1.Id, * ID_STORE_TO = item.ID_STORE, * DATE = DateTime.Now * };*/ #endregion } this.plInvoice.SetId((long)0); InvoiceAuto_BL invoiceAutoBL = new InvoiceAuto_BL(); this.invoiceAuto.Items.Clear(); // очистка таблицы if (IdStoreTo > 0) { this.invoiceAuto.Items.AddRange(invoiceAutoBL.ListRest(this.pluginBox1.RowItem.Id, IdStoreTo)); } else { this.invoiceAuto.Items.AddRange(invoiceAutoBL.ListRest(this.pluginBox1.RowItem.Id)); } this.TransformData(); }
public void addToStore(string name, string price, int kol, string mail) { WebStoreEntities db = new WebStoreEntities(); STORE dbStore = new STORE(); var dbUser = db.USERS.ToList(); var dbProd = db.PRODUCTS.ToList(); int idProd = dbProd.Single(x => x.PRODUCTNAME == name).ID; //string mail = HttpContext.Response.Cookies["mail"].Value; int idUser = dbUser.Single(x => x.EMAIL == mail).ID; dbStore.LOGIN_ID = idUser; dbStore.PROD_ID = idProd; dbStore.KOL = kol; db.STORE.Add(dbStore); db.SaveChanges(); }
private void InvoiceAutoForm_Load(object sender, EventArgs e) { this.storeDict.Clear(); ePlus.Dictionary.Server.STORE_BL bL = (ePlus.Dictionary.Server.STORE_BL)BLProvider.Instance.GetBL(typeof(ePlus.Dictionary.Server.STORE_BL)); ArrayList arrayLists = bL.List("DATE_DELETED IS NULL"); for (int i = 0; i < arrayLists.Count; i++) { STORE item = (STORE)arrayLists[i]; this.storeDict.Add(i, item.NAME); this.chStore.Items.Add(item, false); } this.grdItems.ContextMenuGrid.Items.Clear(); this.TransformData(); }
//CREATE Store public JsonResult CreateStore(STORE store) { try { db.STORE.Add(store); db.SaveChanges(); } catch (Exception e) { Console.Write(e.Data + "Exception Occured"); return(new JsonResult { Data = "Store Create Failed", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } return(new JsonResult { Data = "Success", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult DeleteDepo(int id) { using (sayazilimEntities db = new sayazilimEntities()) { STORE str = db.STORE.Where(x => x.ID == id).FirstOrDefault(); if (str.Merkez == true) { return(Json(new { success = false, message = "Merkez Depo Silinemez." }, JsonRequestBehavior.AllowGet)); } else { STORE emp = db.STORE.Where(x => x.ID == id).FirstOrDefault <STORE>(); db.STORE.Remove(emp); db.SaveChanges(); return(Json(new { success = true, message = "Kayıt Silindi" }, JsonRequestBehavior.AllowGet)); } } }
protected void btnSave_Click(object sender, EventArgs e) { var obj = new STORE(); obj.PROVINCE_ID = Convert.ToInt32(ddlProvince.SelectedValue); obj.SECTOR_ID = Convert.ToInt32(ddlSector.SelectedValue); obj.ROAD_ID = Convert.ToInt32(ddlRoad.SelectedValue); obj.STORE_ADDR1 = txtAddress.Text; obj.STORE_CODE = popTxtStoreCode.Text; obj.STORE_DISTRICT = txtAmpur.Text; obj.STORE_FAX = txtFax.Text; obj.STORE_MOBILE = txtMobli.Text; obj.STORE_NAME = poptxtStoreName.Text; obj.STORE_POSTCODE = txtPostCode.Text; obj.STORE_STREET = txtRoad.Text; obj.STORE_SUBDISTRICT = txtTumbon.Text; obj.STORE_TEL1 = txtTel1.Text; obj.STORE_TEL2 = txtTel2.Text; obj.ZONE_ID = Convert.ToInt32(ddlZone.SelectedValue); var cmd = new StoreService(obj); if (flag.Text.Equals("Add")) { obj.Action = ActionEnum.Create; obj.CREATE_DATE = DateTime.Now; obj.CREATE_EMPLOYEE_ID = 0; obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Add(); } else { obj.Action = ActionEnum.Update; obj.STORE_ID = Convert.ToInt32(ViewState["stoId"].ToString()); obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Edit(); } ViewState["stoId"] = null; Response.Redirect("SearchStore.aspx"); }
//GET Update Store public JsonResult GetUpdateStore(int id) { try { STORE store = db.STORE.Where(x => x.ID == id).SingleOrDefault(); string value = JsonConvert.SerializeObject(store, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(Json(value, JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.Write(e.Data + "Exception Occured"); return(new JsonResult { Data = "Store Not Found", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
//UPDATE Store public JsonResult UpdateStore(STORE store) { try { STORE sto = db.STORE.Where(p => p.ID == store.ID).SingleOrDefault(); sto.NAME = store.NAME; sto.ADDRESS = store.ADDRESS; db.SaveChanges(); } catch (Exception e) { Console.Write(e.Data + "Exception Occured"); return(new JsonResult { Data = "Store Update Failed", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } return(new JsonResult { Data = "Success", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult GetDepoHareketler() { string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; List <DepoHareket> yonetim = new List <DepoHareket>(); string FirmaID = Session["FirmaID"].ToString(); string sorg = @"set dateformat dmy;select s.IslemTarih as IslemTarihiF2,* from STORE_PROCESS s,STORE_PROCESS_DETAIL d where d.DepoIslemID = s.ID and s.FirmaID=" + Session["FirmaID"].ToString(); using (SqlConnection con = new SqlConnection(strcon)) { con.Open(); using (SqlCommand dekontgetir = new SqlCommand(sorg, con)) { using (SqlDataReader dr = dekontgetir.ExecuteReader()) { while (dr.Read()) { DepoHareket yt = new DepoHareket(); yt.IslemNo = dr["IslemKodu"].ToString(); yt.IslemTuru = dr["IslemTipi"].ToString(); yt.IslemTarih = Convert.ToDateTime(dr["IslemTarihiF2"].ToString()).ToString("dd.MM.yyyy"); yt.TarihF2 = Convert.ToDateTime(dr["IslemTarihiF2"].ToString()).ToString("dd.MM.yyyy"); int urunid = Convert.ToInt32(dr["urunID"].ToString()); Stok st = db.Stok.Where(x => x.ID == urunid).FirstOrDefault(); yt.UrunAdi = st.UrunAdi; yt.UrunKodu = st.StokKodu; yt.Miktar = Convert.ToDecimal(dr["urunMiktar"].ToString()).ToString("N2"); yt.Fiyat = Convert.ToDecimal(dr["urunFiyat"].ToString()).ToString("N2"); yt.Tutar = Convert.ToDecimal(dr["Tutar"].ToString()).ToString("N2"); yt.Aciklama = dr["Aciklama"].ToString(); int personelid = Convert.ToInt32(dr["personelID"].ToString()); Personel pr = db.Personel.Where(x => x.ID == personelid).FirstOrDefault(); yt.Personel = (pr.Adi + " " + pr.Soyadi).TrimEnd(); int gdepoid = Convert.ToInt32(dr["GonderenDepoID"].ToString()); yt.AlanDepoID = dr["AlanDepoID"].ToString(); yt.GonderenDepoID = dr["GonderenDepoID"].ToString(); if (gdepoid != -1) { STORE depo = db.STORE.Where(x => x.ID == gdepoid).FirstOrDefault(); yt.GonderenDepo = depo.DepoAdi; yt.IslemTuru = "Depo Çıkışı"; } else { yt.GonderenDepo = ""; } int adepoid = Convert.ToInt32(dr["AlanDepoID"].ToString()); if (adepoid != -1) { STORE depo = db.STORE.Where(x => x.ID == adepoid).FirstOrDefault(); yt.AlanDepo = depo.DepoAdi; yt.IslemTuru = "Depo Girişi"; } else { yt.AlanDepo = ""; } yt.ID = dr["ID"].ToString(); if (adepoid != -1 && gdepoid != -1) { yt.IslemTuru = "Depo Transfer"; } yonetim.Add(yt); } } } } return(Json(new { data = yonetim.ToList() }, JsonRequestBehavior.AllowGet)); }
public StoreService(STORE item) { _item = item; }
public static bool UpdateSTORE(STORE sTORE) { SqlSTOREProvider sqlSTOREProvider = new SqlSTOREProvider(); return(sqlSTOREProvider.UpdateSTORE(sTORE)); }
public static int InsertSTORE(STORE sTORE) { SqlSTOREProvider sqlSTOREProvider = new SqlSTOREProvider(); return(sqlSTOREProvider.InsertSTORE(sTORE)); }
private void bMove_Click(object sender, EventArgs e) { int num = 0; this.grdItems.DataGridView.EndEdit(); this.SyncItems(); if (!this.ValidateDocument()) { return; } if (this.invoiceAuto.Items.Count == 0 || MessageBox.Show("Создать документы перемещения?", "Подтверждение", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { return; } for (int i = 0; i < this.chStore.Items.Count; i++) { STORE item = (STORE)this.chStore.Items[i]; MOVEMENT mOVEMENT = new MOVEMENT() { MNEMOCODE = DOCUMENT_DALC.GetDocumentNumber((long)8), DOCUMENT_STATE = (new DocumentState((EDocumentState)((long)1))).Mnemocode, ID_STORE_FROM = this.pluginBox1.Id, ID_STORE_TO = item.ID_STORE, DATE = DateTime.Now }; mOVEMENT.Items.Clear(); foreach (InvoiceAutoItem invoiceAutoItem in this.invoiceAuto.Items) { if (invoiceAutoItem.Left_quantity < new decimal(0) || i >= invoiceAutoItem.Quantities.Count || invoiceAutoItem.Quantities[i] == new decimal(0)) { continue; } MOVEMENT_ITEM mOVEMENTITEM = new MOVEMENT_ITEM() { ID_LOT_FROM = invoiceAutoItem.Id_party, QUANTITY = invoiceAutoItem.Quantities[i] }; // mOVEMENTITEM.QUANTITY = Math.Floor(mOVEMENTITEM.QUANTITY); //2019 почему то попадают десятичные значения в количество mOVEMENT.Items.Add(mOVEMENTITEM); } if (mOVEMENT.Items.Count > 0) { num++; (new MOVEMENT_BL()).Save(mOVEMENT); long dMOVEMENT = mOVEMENT.ID_MOVEMENT; this.filter = string.Format("{0}{1}", (string.IsNullOrEmpty(this.filter) ? string.Empty : string.Concat(this.filter, ", ")), dMOVEMENT); } } ePlus.MetaData.Core.Logger.ShowMessage(string.Format("Операция завершена.\r\nСоздано {0} документа(ов)", num), 0, MessageBoxIcon.Asterisk); base.Close(); if (num > 0) { PluginFormView pluginView = AppManager.GetPluginView("Movement"); if (pluginView != null) { AppManager.RegisterForm(pluginView, ""); if (!string.IsNullOrEmpty(this.filter)) { pluginView.Grid(0).SetParameterValue("@ADV_FILTER", string.Format("ID_MOVEMENT IN ({0})", this.filter)); } pluginView.Show(); } } }
public static void InsertGoogleStore(string storejson) { Store s = myConvert.Deserialize<Store>(storejson); try { if (s == null) { return; } Random r = new Random(); int i = r.Next(0, 6); //string[] users = new string[6] { "gdabli", "harshisame", "nari.dontula", "rungta.sachin", "SiChen", "YongZhuang" }; string[] users = new string[6] { "Gaurav_Dabli", "Harshita_Gupta", "Harshita_Gupta", "Nari_Dontula", "Nari_Dontula", "Yong_Zhuang" }; if (mydb.STOREs.SingleOrDefault(ss => ss.PLACE_ID == s.place_id) != null) { return; } //{ "geometry": { "location": { "k": 42.360128, "B": -71.055454 } }, "name": "Cheers", "types": ["cafe", "bar", "restaurant", "food", "establishment"], "vicinity": "1 S Market St, Boston", "html_attributions": [] } STORE store = new STORE() { NAME = s.name, PLACE_ID = s.place_id, PRICE_LEVEL = s.price_level, RATING = s.rating, PHONE = s.formatted_phone_number, WEBSITE = s.website, OWNER = users[i], GOOGLE_URL = s.url }; LOCATION location = new LOCATION() { LATITUDE = s.geometry.location.k, LONGITUDE = s.geometry.location.B }; mydb.LOCATIONs.InsertOnSubmit(location); store.LOCATION = location; ADDRESS address = new ADDRESS() { ADDRESS_LINE1 = s.vicinity.Split(',')[0], CITY = s.vicinity.Split(',')[1] }; if (s.address_components != null) { foreach (Address_Components ad in s.address_components) { foreach (string type in ad.types) { switch (type) { case "country": { address.COUNTRY = ad.long_name; break; } case "postal_code": { address.POSTAL_CODE = ad.long_name; break; } case "administrative_area_level_1": { address.STATE_PROVINCE_REGION = ad.long_name; break; } } } } } mydb.ADDRESSes.InsertOnSubmit(address); store.ADDRESS = address; if (s.opening_hours != null) { foreach (Period period in s.opening_hours.periods) { PERIOD p = new PERIOD() { OPEN_DAY = period.open.day, CLOSE_DAY = period.close.day, OPEN_TIME = Convert.ToDateTime(period.open.hours + ":" + period.open.minutes).TimeOfDay, CLOSE_TIME = Convert.ToDateTime(period.close.hours + ":" + period.close.minutes).TimeOfDay }; store.PERIODs.Add(p); } } if (s.reviews != null) { foreach (Review review in s.reviews) { if (string.IsNullOrEmpty(review.author_name) || review.author_name == "A Google User") { continue; } USER user = mydb.USERs.SingleOrDefault(u => u.FIRST_NAME + " " + u.LAST_NAME == review.author_name); if (user == null) { string[] name = review.author_name.Split(' '); if (name.Length > 1) { user = new USER() { FIRST_NAME = name[0], LAST_NAME = name[1], USER_ID = name[0] + "_" + name[1], EMAIL = name[0] + "." + name[1] + "@gmail.com", PASSWORD = "******", ROLE = "0", REGISTER_DATE = DateTime.Now }; } else if (name.Length > 0) { user = new USER() { FIRST_NAME = name[0], LAST_NAME = "", USER_ID = name[0], EMAIL = name[0] + "@gmail.com", PASSWORD = "******", ROLE = "0", REGISTER_DATE = DateTime.Now }; } mydb.USERs.InsertOnSubmit(user); } if (user != null) { FEEDBACK feed = new FEEDBACK() { COMMENT = review.text, RATING = review.rating }; feed.IS_LIKED = feed.RATING > 2.5 ? 1 : 0; feed.USER = user; feed.STORE = store; mydb.FEEDBACKs.InsertOnSubmit(feed); } } } if (s.types != null) { foreach (string type in s.types) { CATEGORY catergory = mydb.CATEGORies.SingleOrDefault(c => c.NAME == type); if (catergory == null) { catergory = new CATEGORY() { NAME = type, LAYER = 1, PARENT = 0 }; mydb.CATEGORies.InsertOnSubmit(catergory); } STORE_CATEGORY s_c = new STORE_CATEGORY(); s_c.CATEGORY = catergory; s_c.STORE = store; mydb.STORE_CATEGORies.InsertOnSubmit(s_c); } } mydb.SubmitChanges(); } catch (Exception e) { throw e; } }
public Store(STORE idx) { sidx = idx; stock = new Object.Object[INVEN_MAX]; stock_size = (short)INVEN_MAX; }
public ActionResult Data(Resim file) { if (file.Dosya.ContentLength > 0) { var filenamecmr = Path.GetFileName(file.Dosya.FileName); var kayityeri = Path.Combine(@"C:/FRANCBELGELER", filenamecmr); if (System.IO.File.Exists(kayityeri)) { kayityeri = Path.Combine(@"C:/FRANCBELGELER", filenamecmr); } else { } file.Dosya.SaveAs(kayityeri); DataTable dt = ConvertExcelToDataTable(kayityeri); int EmpID = -1; string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; try { using (SqlConnection conp = new SqlConnection(strcon)) { if (conp.State == ConnectionState.Closed) { conp.Open(); } using (SqlCommand command = new SqlCommand("SELECT MAX(ID)+1 From Stok", conp)) { EmpID = Convert.ToInt32(command.ExecuteScalar()); } } } catch { } if (EmpID == -1 || EmpID == 0) { EmpID = 1; } try { System.IO.File.WriteAllText(Path.Combine(@"C:\Users\alper\AppData\Local\Sayazilim", "sonuç.xml"), dt.Rows.Count.ToString()); } catch { } int aktarimsay = 0; using (sayazilimEntities db = new sayazilimEntities()) { for (int i = 0; i < dt.Rows.Count; i++) { string Yetkili = ""; bool kayitvar = false; if (kayitvar == false) { using (SqlConnection conp = new SqlConnection(strcon)) { if (conp.State == ConnectionState.Closed) { conp.Open(); } using (SqlDataAdapter daBASVURULAR = new System.Data.SqlClient.SqlDataAdapter("select Top 1 * from Stok", strcon)) { using (SqlCommandBuilder cb = new SqlCommandBuilder(daBASVURULAR)) { try { DateTime Duzenleme = DateTime.Now; string stokkodu = dt.Rows[i]["Kod"].ToString(); short firmaID = Convert.ToInt16(Session["FirmaID"].ToString()); Stok stk = db.Stok.Where(x => x.FirmaID == firmaID && x.StokKodu == stokkodu).FirstOrDefault <Stok>(); Stok st = new Stok(); if (stk != null) { AyarMetot.Siradaki("", "Stok", "StokKodu", Session["FirmaID"].ToString()); st.StokKodu = AyarMetot.GetNumara; } else { st.StokKodu = stokkodu; } st.UrunAdi = dt.Rows[i]["Ad"].ToString(); try { st.Marka = dt.Rows[i]["Marka"].ToString(); } catch { }; try { st.Grubu = dt.Rows[i]["Grubu"].ToString(); } catch { }; try { st.StoktaKalan = Convert.ToInt32(dt.Rows[i]["Ürün Miktarı"].ToString()); } catch { }; try { st.Kategori1 = dt.Rows[i]["Kategori1"].ToString(); } catch { }; try { st.Kategori2 = dt.Rows[i]["Kategori2"].ToString(); } catch { }; try { st.Kategori3 = dt.Rows[i]["Kategori3"].ToString(); } catch { }; try { st.Kategori4 = dt.Rows[i]["Kategori4"].ToString(); } catch { }; try { st.UrunTuru = dt.Rows[i]["Ürün Türü"].ToString(); } catch { }; try { st.AlishFiyat = Convert.ToInt32(dt.Rows[i]["Alış Fiyatı"].ToString()); } catch { }; try { st.SatishFiyat = Convert.ToInt32(dt.Rows[i]["Satış Fiyat"].ToString()); } catch { }; try { st.KDV = Convert.ToInt32(dt.Rows[i]["Kdv"].ToString()); } catch { }; try { st.ParaBirimi = dt.Rows[i]["Satış PB"].ToString(); } catch { }; try { st.Barkod = dt.Rows[i]["Barkod"].ToString(); } catch { }; try { st.F2 = Convert.ToInt32(dt.Rows[i]["F2"].ToString()); } catch { }; try { st.F4 = Convert.ToInt32(dt.Rows[i]["F4"].ToString()); } catch { }; try { st.F5 = Convert.ToInt32(dt.Rows[i]["F5"].ToString()); } catch { }; try { st.F3 = Convert.ToInt32(dt.Rows[i]["F3"].ToString()); } catch { }; try { string depoadi = dt.Rows[i]["Depo Adı"].ToString(); STORE store = db.STORE.Where(x => x.DepoAdi == depoadi && x.FirmaID == firmaID) .FirstOrDefault <STORE>(); st.SdepoID = store.ID; } catch { } st.FirmaID = firmaID; string firmaid = Session["FirmaID"].ToString(); string company_code = "SA01" + firmaid.PadLeft(3, '0'); st.Company_Code = company_code; aktarimsay++; db.Stok.Add(st); db.SaveChanges(); if (stk.StoktaKalan != 0) { int depoIslId = 0; using (SqlConnection con = new SqlConnection(AyarMetot.strcon)) { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataAdapter daDepoIslm = new System.Data.SqlClient.SqlDataAdapter("select Top 1 * from STORE_PROCESS", con)) { using (SqlCommandBuilder cb1 = new SqlCommandBuilder(daDepoIslm)) { DataSet dsDepoIslm = new DataSet(); daDepoIslm.Fill(dsDepoIslm, "STORE_PROCESS"); DataRow dd = dsDepoIslm.Tables["STORE_PROCESS"].NewRow(); dd["IslemKodu"] = stk.ID + "STK"; dd["IslemTarih"] = DateTime.Now.ToString("dd.MM.yyyy"); dd["GonderenDepoID"] = -1; dd["AlanDepoID"] = Session["vDepoID"].ToString(); dd["Aciklama"] = "Stok Açılış Depo Girişi " + DateTime.Now.ToString("dd.MM.yyyy"); dd["Tutar"] = stk.AlishFiyat * stk.StoktaKalan; dd["paraBirimi"] = stk.ParaBirimi; dd["personelID"] = AyarMetot.PersonelID; dd["Donem"] = AyarMetot.Donem; dd["KayitPersonelID"] = AyarMetot.PersonelID; dsDepoIslm.Tables["STORE_PROCESS"].Rows.Add(dd); daDepoIslm.Update(dsDepoIslm, "STORE_PROCESS"); } } } using (SqlConnection conp1 = new SqlConnection(AyarMetot.strcon)) { if (conp1.State == ConnectionState.Closed) { conp1.Open(); } using (SqlCommand sID = new SqlCommand(@"select top (1) ID FROM STORE_PROCESS Order BY ID Desc", conp1)) { depoIslId = Convert.ToInt32(sID.ExecuteScalar()); } } using (SqlConnection con = new SqlConnection(AyarMetot.strcon)) { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataAdapter daSDepoIslm = new System.Data.SqlClient.SqlDataAdapter("select Top 1 * from STORE_PROCESS_DETAIL", con)) { using (SqlCommandBuilder cb1 = new SqlCommandBuilder(daSDepoIslm)) { DataSet dsSDepoIslm = new DataSet(); daSDepoIslm.Fill(dsSDepoIslm, "STORE_PROCESS_DETAIL"); DataRow ds = dsSDepoIslm.Tables["STORE_PROCESS_DETAIL"].NewRow(); ds["DepoIslemID"] = depoIslId; ds["IslemTarihi"] = DateTime.Now.ToString("dd.MM.yyyy"); ds["gDepoID"] = -1; ds["aDepoID"] = Session["vDepoID"].ToString(); ds["urunID"] = stk.ID; ds["urunFiyat"] = stk.AlishFiyat; ds["urunMiktar"] = stk.StoktaKalan; ds["paraBirimi"] = stk.ParaBirimi; ds["variyantID"] = -1; ds["Kur"] = 1; ds["Donem"] = AyarMetot.Donem; ds["personelID"] = AyarMetot.PersonelID; ds["OzelKodID"] = -1; dsSDepoIslm.Tables["STORE_PROCESS_DETAIL"].Rows.Add(ds); daSDepoIslm.Update(dsSDepoIslm, "STORE_PROCESS_DETAIL"); } } } } EmpID++; } catch (Exception E1) { try { System.IO.File.WriteAllText(Path.Combine(@"C:\Users\alper\AppData\Local\Sayazilim", "sonuç.xml"), E1.ToString()); } catch { } } } } } } } } ViewBag.Aktarilan = "Başarılı Aktarılan Stok Sayısı: " + aktarimsay.ToString(); ViewBag.Sayi = "Toplam Stok Sayısı: " + aktarimsay.ToString(); ViewBag.Success = "STOKLAR BAŞARIYLA AKTARILDI"; } //if the code reach here means everthing goes fine and excel data is imported into database return(View()); }
private void InitialDataPopup() { var cmd = new SectorService(); var list = cmd.GetALL(); foreach (var item in list) { ddlSector.Items.Add(new ListItem(item.SECTOR_NAME, item.SECTOR_ID.ToString())); } var cmdPro = new ProvinceService(); ViewState["listProvince"] = cmdPro.GetALL(); foreach (var item in (List <PROVINCE>)ViewState["listProvince"]) { ddlProvince.Items.Add(new ListItem(item.PROVINCE_NAME, item.PROVINCE_ID.ToString())); } var cmdRoad = new RoadService(); ViewState["listRoad"] = cmdRoad.GetALL(); foreach (var item in (List <ROAD>)ViewState["listRoad"]) { ddlRoad.Items.Add(new ListItem(item.ROAD_NAME, item.ROAD_ID.ToString())); } var cmdZone = new ZoneService(); var listZone = cmdZone.GetALL(); foreach (var item in listZone) { ddlZone.Items.Add(new ListItem(item.ZONE_NAME, item.ZONE_ID.ToString())); } if (ViewState["stoId"] != null) { var cmdStore = new StoreService(); _store = cmdStore.Select(Convert.ToInt32(ViewState["stoId"].ToString())); if (_store != null) { txtAddress.Text = _store.STORE_ADDR1; txtAmpur.Text = _store.STORE_DISTRICT; txtFax.Text = _store.STORE_FAX; txtMobli.Text = _store.STORE_MOBILE; txtPostCode.Text = _store.STORE_POSTCODE; popTxtStoreCode.Text = _store.STORE_CODE; poptxtStoreName.Text = _store.STORE_NAME; txtTel1.Text = _store.STORE_TEL1; txtTel2.Text = _store.STORE_TEL2; txtTumbon.Text = _store.STORE_SUBDISTRICT; ddlSector.SelectedValue = _store.SECTOR_ID.ToString(); ddlProvince.SelectedValue = _store.PROVINCE_ID.ToString(); ddlProvince.Enabled = true; ddlZone.SelectedValue = _store.ZONE_ID.ToString(); //if (ddlProvince.SelectedItem.Text.Equals("กรุงเทพมหานคร")) //{ ddlRoad.Visible = true; ddlRoad.SelectedValue = _store.ROAD_ID.ToString(); txtRoad.Visible = false; //} //else //{ // txtRoad.Text = _store.STORE_STREET; // ddlRoad.Visible = false; //} flag.Text = "Edit"; } } }