public JsonResult Register(WebService.Contact contact, string seria, string note, string reseller, string capcha) { string _msg = ""; //contact.District = ""; //contact.Province=""; contact.StoreId = StoreID.ToString(); seria = seria.Replace(" ", string.Empty).Trim(); contact.IdCard = contact.IdCard.Replace(" ", string.Empty).Trim(); string rs = service.RegisterSeria(contact, seria, reseller, note, capcha, StoreID, TokenKey, out _msg); return(Json(new { code = rs, msg = _msg })); }
public void SQLStore(SqlConnection conn) { DataTable StoreData = new DataTable(); SqlCommand SelectStore = new SqlCommand("Select * From Store Where StoreNumber = @Store and RegisterCount = @Registers", conn); SelectStore.Parameters.AddWithValue("@Store", Workgroup); SelectStore.Parameters.AddWithValue("@Registers", RegisterCount); try { conn.Open(); SqlDataAdapter da = new SqlDataAdapter(SelectStore); da.Fill(StoreData); conn.Close(); if (StoreData.Rows.Count != 0) { StoreID = Convert.ToInt32(StoreData.Rows[0][0]); } else { SqlCommand AddStore = new SqlCommand("Insert Into Store (StoreNumber,RegisterCount) Values (@Store,@Registers)", conn); AddStore.Parameters.AddWithValue("@Store", Workgroup); AddStore.Parameters.AddWithValue("@Registers", RegisterCount); conn.Open(); AddStore.ExecuteNonQuery(); SqlDataAdapter ad = new SqlDataAdapter(SelectStore); ad.Fill(StoreData); ad.Dispose(); conn.Close(); StoreID = Convert.ToInt32(StoreData.Rows[0][0]); MessageBox.Show("added store " + StoreID.ToString()); } da.Dispose(); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public string GetKey() { return(StoreID.ToString() + Year.ToString()); }
protected void lvINVStore_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 StoreID; Int64.TryParse(e.CommandArgument.ToString(), out StoreID); if (StoreID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _StoreID = StoreID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(INVStoreEntity.FLD_NAME_StoreID, StoreID.ToString(), SQLMatchType.Equal); INVStoreEntity iNVStoreEntity = new INVStoreEntity(); result = FCCINVStore.GetFacadeCreate().Delete(iNVStoreEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _StoreID = 0; _INVStoreEntity = new INVStoreEntity(); PrepareInitialView(); BindINVStoreList(); MiscUtil.ShowMessage(lblMessage, "I NVStore has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete I NVStore.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }